在这篇文章中,我们将带领您了解java–weblogic.xml中的错误:cvc-complex-type.2.4.a:找到以元素’prefer-application-packages’开头的无效内
在这篇文章中,我们将带领您了解java – weblogic.xml中的错误:cvc-complex-type.2.4.a:找到以元素’prefer-application-packages’开头的无效内容的全貌,同时,我们还将为您介绍有关application.properties 在 maven-compiler-plugin 期间更改、applicationId和packageName,以及在Manifest中使用${applicationId}写法、BEA-141150 - An error occurred while preparing application component uri of application application with HTTP response responseCode: message、com.badlogic.gdx.Application.ApplicationType的实例源码的知识,以帮助您更好地理解这个主题。
本文目录一览:- java – weblogic.xml中的错误:cvc-complex-type.2.4.a:找到以元素’prefer-application-packages’开头的无效内容
- application.properties 在 maven-compiler-plugin 期间更改
- applicationId和packageName,以及在Manifest中使用${applicationId}写法
- BEA-141150 - An error occurred while preparing application component uri of application application with HTTP response responseCode: message
- com.badlogic.gdx.Application.ApplicationType的实例源码
java – weblogic.xml中的错误:cvc-complex-type.2.4.a:找到以元素’prefer-application-packages’开头的无效内容
我正在使用spring source工具套件.
我在weblogic.xml文件中收到错误 –
cvc-complex-type.2.4.a: Invalid content was found starting with element 'prefer-
application-packages'. One of '{"http://www.bea.com/ns/weblogic/weblogic-web-app":retain-
original-url, "http://www.bea.com/ns/weblogic/weblogic-web-app":show-archived-real-path-
enabled, "http://www.bea.com/ns/weblogic/weblogic-web-app":require-admin-traffic,
"http://www.bea.com/ns/weblogic/weblogic-web-app":access-logging-disabled}' is expected.
enter code here
我的weblogic.xml看起来像这样
<?xml version="1.0"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app
http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<jsp-descriptor>
<keepgenerated>true</keepgenerated>
<page-check-seconds>60</page-check-seconds>
<precompile>true</precompile>
<precompile-continue>true</precompile-continue>
</jsp-descriptor>
<container-descriptor>
<optimistic-serialization>true</optimistic-serialization>
<prefer-application-packages>
<package-name>antlr.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.apache.commons.*</package-name>
</prefer-application-packages>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>
</weblogic-web-app>
错误显示在标签的开头..
解决方法:
我对weblogic一无所知,但你引用的架构
http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd
显示容器描述符元素中期望的子元素,并且它们不允许prefer-application-packages元素.
application.properties 在 maven-compiler-plugin 期间更改
如何解决application.properties 在 maven-compiler-plugin 期间更改?
Github 存储库
https://github.com/rennyong/demo
Maven 命令
mvn clean package -Pprod -Dmaven.test.skip=true
异常行为
如果您在 maven 命令运行时离开 target/classes/resources/application.properties,您将看到以下异常行为: 已删除 >> spring.profiles.active=prod spring.profiles.active=@spring.profiles.active@
预期结果/结果
应仅过滤以下属性!
spring.profiles.active=prod
POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- File Download-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<!--metamodel Generator
Auto generation of Meta model for specifications-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.29.Final</version>
<scope>provided</scope>
</dependency>
<!--Mapping Dto-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.4.2.Final</version>
</dependency>
<!--
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<scope>provided</scope>
</dependency> -->
<!-- Auto Generation of getter/setter and constructor-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.18</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>show-profiles</id>
<phase>compile</phase>
<goals>
<goal>active-profiles</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<!-- This is needed when using Lombok 1.18.16 and above -->
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.4.2.Final</version>
</path>
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.29.Final</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
</profiles>
</project>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
applicationId和packageName,以及在Manifest中使用${applicationId}写法
1. 前言
- 本文资料来源网络公开资源,并根据个人实践见解纯手打整理,如有错误请随时指出。
- 本文主要用于个人积累及分享,文中可能引用其他技术大牛文章(仅引用链接不转载),如有侵权请告知必妥善处理。
2. applicationId
和packageName
2.1. IDE
为Eclipse
时
applicationId
基于gradle编译,Eclipse IDE
不存在applicationId
,也不能使用它,请忽略。
2.2. IDE
为Android Studio
时
2.2.1 applicationId
- 理论上来讲
applicationId
是android
设备以及google play
所公认的唯一标示。 - 若未配置
applicationId
时,google play
无法上线(据查) - 配置
applicationId
可以用作同一工程发布略有差异的不同apk
,比如收费版和免费版、代码相同标示不同的渠道包等。 -
配置方法(在
app
的build.gradle
中):-
一般配置
android { ...... defaultConfig { applicationId "sp.com.learncomposite" ...... } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
-
设置不同的
applicationId
配置
其中关于productFlavors
的应用可以参考这篇文章很详细:链接,或者参考官方文档:链接1,链接2。android { ...... productFlavors { pro { applicationId = "sp.com.learncomposite.pro" } free { applicationId = "sp.com.learncomposite.free" } } buildTypes { ...... debug { applicationIdSuffix ".debug" } } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
-
-
当
release
打包时,在签名界面,可以选择你将要打出的包,也可以多选并同时打出:
-
当
debug
调试时,可以再Android studio
左下角的Build Variants
标签中选择当前调试的是哪个包:
2.2.2 packageName
- 将仅被代码(如资源文件
R.java
)或Manifest
清单中声明(如类的包路径和packageName
相同时,activity
的name
缩写为”.xxxActivity
“)使用。
2.2.3 两者纠缠的关系
- 当
applicationId
不存在时,applicationId
将默认为packageName
。 - 当
applicationId
存在时,packageName
仅有其本身的功能,而applicationId
将作为唯一标示。
3. 在Manifest
中使用${applicationId}
-
如
Provider
在声明android:authorities
(该值必须唯一)时,如前缀为写死的包名字符串,当出现需要同一工程分包、分渠道打包时,安装在同一android
设备将导致INSTALL FAILED CONFLICTING PROVIDER
的报错(使用adb
安装会有提示),这时可以使用${applicationId}
,这将避免android:authorities
值非唯一的问题。<provider android:name="xxxx.xxxx.xxx.xxxProvider" android:authorities="${applicationId}.xxxx" android:grantUriPermissions="true" android:exported="false"/>
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
-
${applicationId}
也可以用在Manifest
中其他需要唯一的取值情况,这种使用方式很灵活。
BEA-141150 - An error occurred while preparing application component uri of application application with HTTP response responseCode: message
网上查询的
Cause:This is either because the resource it self is not available on the administration server or due a misconfiguration of security such that the managed server is not properly authorized to download application resources.
我的实际问题是:
admin 地址被修改导致。
com.badlogic.gdx.Application.ApplicationType的实例源码
/**创建一个Card2DEngine实例 */ public static final Engine newEngine(BaseGame card2dAppListener) { if(_instance == null){ if(_engineMode == null) { if(Gdx.app.getType() == ApplicationType.Desktop) { _engineMode = EngineMode.SingleThread; //桌面版本经过测试,backend已经实现了渲染线程分离,因此默认使用single模式 } else { _engineMode = EngineMode.DoubleThread; } } cclog.engine("Engine",">>>>>>>>>>>>>>>>>> engine run mode : " + _engineMode); _instance = new Engine(); _instance.game = card2dAppListener; _instance.director = Director.getInstance(); _instance.baseScheduler = BaseScheduler.instance(); } return _instance; }
public void startCubes() { compatibility = this; Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler.instance); Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandler.instance); try { if (applicationType == ApplicationType.HeadlessDesktop) { run(new ServerAdapter()); } else { run(new ClientAdapter()); } } catch (Exception e) { try { Log.error("Failed to start",CubesException.get(e)); } catch (Exception ex) { if (ex instanceof CubesException) { throw (CubesException) ex; } else { throw CubesException.get(e); } } } }
public void startCubes() { compatibility = this; Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler.instance); Thread.currentThread().setUncaughtExceptionHandler(UncaughtExceptionHandler.instance); try { if (applicationType == ApplicationType.HeadlessDesktop) { run(new ServerAdapter()); } else { run(new ClientAdapter()); } } catch (Exception e) { try { Log.error("Failed to start",CubesException.get(e)); } catch (Exception ex) { if (ex instanceof CubesException) { throw (CubesException) ex; } else { throw CubesException.get(e); } } } }
@Override public void create () { // Net Shit System.out.println("Good morning!"); game = this; batch = new SpriteBatch(); if(Gdx.app.getType() == ApplicationType.Desktop) { // Run server server = new NetServer(); setScreen(new SplashScreen(game)); } else { // Run client client = new NetClient(); setScreen(new LobbyScreen(game)); } }
/** * Method called once when the application is created. */ @Override public void create() { //Load all textures TextureManager.load(); AudioManager.load(); this.setScreen(new StartScreen(this,client,server)); if(Constants.TINYWINDOWS) { Gdx.graphics.setwindowedMode(Constants.SCREENWIDTH / 2,Constants.SCREENHEIGHT/ 2); } if(Gdx.app.getType().equals(ApplicationType.Android)) { Constants.ISRUNNINGONSMARTPHONE = true; } }
@Override public void pause() { if (!Gdx.app.getType().equals(ApplicationType.Desktop)) { systemPaused = true; } log("Pause"); Gdx.input.setInputProcessor(null); if (music != null) { if (!Gdx.app.getType().equals(ApplicationType.Desktop)) { wasMusicPlaying = music.isPlaying(); music.pause(); } } else { wasMusicPlaying = false; } }
public static void saveScreenshot(final int w,final int h,final String prefix) { try { FileHandle fh; do { if (Gdx.app.getType() == ApplicationType.Desktop) { fh = Gdx.files.local("bin/screenshot_" + prefix + "_" + counter++ + ".png"); } else { fh = Gdx.files.local("screenshot_" + prefix + "_" + counter++ + ".png"); } } while (fh.exists()); final pixmap pixmap = getScreenshot(0,w,h,true); pixmapIO.writePNG(fh,pixmap); pixmap.dispose(); Gdx.app.log("screenshot","Screenshot saved to " + fh); } catch (final Exception e) { } }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,480,320); spriteBatch.setProjectionMatrix(viewMatrix); spriteBatch.setTransformMatrix(transformMatrix); spriteBatch.begin(); spriteBatch.disableBlending(); spriteBatch.setColor(Color.WHITE); spriteBatch.draw(background,320,512,false,false); spriteBatch.enableBlending(); spriteBatch.draw(logo,320 - 128,128,256,false); spriteBatch.setBlendFunction(GL20.GL_ONE,GL20.GL_ONE_MINUS_SRC_ALPHA); glyphLayout.setText(font,"Touch screen to start!"); font.draw(spriteBatch,glyphLayout,240 - glyphLayout.width / 2,128); if (Gdx.app.getType() == ApplicationType.WebGL) { glyphLayout.setText(font,"Press Enter for Fullscreen Mode"); font.draw(spriteBatch,128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void create () { Array<Controller> controllers = Controllers.getControllers(); if (controllers.size > 0) { controller = controllers.first(); } Controllers.addListener(controllerListener); setScreen(new MainMenu(this)); music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3",FileType.Internal)); music.setLooping(true); music.play(); Gdx.input.setInputProcessor(new InputAdapter() { @Override public boolean keyUp (int keycode) { if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) { Gdx.graphics.setFullscreenMode(Gdx.graphics.getdisplayMode()); } return true; } }); fps = new FPSLogger(); }
@Override public void show () { font = new BitmapFont(Gdx.files.internal("fonts/font.fnt")); cache = font.getCache(); if (Gdx.app.getType() == ApplicationType.Android) font.getData().setScale(2); polygonBatch = new polygonspriteBatch(); camera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); pixmap pixmap = new pixmap(1,1,Format.RGB565); pixmap.setColor(Color.WHITE); pixmap.fill(); emptyTexture = new Texture(pixmap); pixmap.dispose(); }
public ShaderManager (String shaderDir,AssetManager am,boolean addProcessors) { shaders = new ObjectMap<String,ShaderProgram>(); shaderPaths = new ObjectMap<String,String>(); sourcesvert = new ObjectMap<String,String>(); sourcesFrag = new ObjectMap<String,String>(); frameBuffers = new ObjectMap<String,FrameBuffer>(); openedFrameBuffers = new Array<String>(true,MAX_FRAMEBUFFERS); screenCamera = new OrthographicCamera(Gdx.graphics.getWidth() + 2,Gdx.graphics.getHeight() + 2); createScreenQuad(); screenCamera.translate(0,-1); screenCamera.update(); setShaderDir(shaderDir); setAssetManager(am); // add("empty","empty.vert","empty.frag"); // add("default","default.vert","default.frag"); if (addProcessors && (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet || Gdx.app.getType() == ApplicationType.WebGL)) { /* * add("processor","processor.vert","processor.frag"); add("processor_blur","processor_blur.frag"); * add("copy","copy.frag"); add("processor_draw","processor_draw.frag"); * add("processor_fill","processor_fill.frag"); */ } }
private void tryLoadDesktopTwitteraPI() { if (Gdx.app.getType() != ApplicationType.Desktop) { Gdx.app.debug(TAG,"Skip loading Twitter API for Desktop. Not running Desktop. \n"); return; } try { final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.desktop.DesktopTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,TwitterConfig.class).newInstance(config); twitteraPI = (TwitteraPI) twitter; Gdx.app.debug(TAG,"gdx-twitter for Desktop loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for Desktop (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
private void tryLoadHTMLTwitteraPI() { if (Gdx.app.getType() != ApplicationType.WebGL) { Gdx.app.debug(TAG,"Skip loading gdx-twitter for HTML. Not running HTML. \n"); return; } try { final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.html.HTMLTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,"gdx-twitter for HTML loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for HTML (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
private void tryLoadioSTWitteraPI() { if (Gdx.app.getType() != ApplicationType.iOS) { Gdx.app.debug(TAG,"Skip loading gdx-twitter for iOS. Not running iOS. \n"); return; } try { // Class<?> activityClazz = // ClassReflection.forName("com.badlogic.gdx.backends.iosrobovm.IOSApplication"); final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.ios.IOSTwitteraPI"); Object twitter = ClassReflection.getConstructor(twitterClazz,TwitterConfig.class).newInstance(config); twitteraPI = (TwitteraPI) twitter; Gdx.app.debug(TAG,"gdx-twitter for iOS loaded successfully."); } catch (ReflectionException e) { Gdx.app.debug(TAG,"Error creating gdx-twitter for iOS (are the gdx-twitter **.jar files installed?). \n"); e.printstacktrace(); } }
public FinishScene(Application app) { setFillParent(true); Label label = new Label("You have beaten this level!",app.getGuiSkin()); add(label); row().padTop(175.f); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or click left to go to the next level",app.getGuiSkin()); label2 = new Label("Press Escape to go back to menu",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to go to the next level",app.getGuiSkin()); label2 = new Label("Press the back button to go back to the menu",app.getGuiSkin()); } add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public PauseScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to resume the game",app.getGuiSkin()); label2 = new Label("Press Escape to go back to the menu",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to resume the game",app.getGuiSkin()); } add(new Label("Game paused",app.getGuiSkin())); row().padTop(150.f); add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public ModalScene(Application app) { setFillParent(true); mText = new Label("No Text set yet",app.getGuiSkin()); mText.setWrap(true); add(mText).width(900); row().padTop(175.f); Label label1; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or click left to resume the game",app.getGuiSkin()); } add(label1); pack(); setColor(1,0); }
public CrashedScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to start again from the last checkpoint",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to start again from the last checkpoint",app.getGuiSkin()); } add(new Label("You crashed into the wall",app.getGuiSkin())); row().padTop(150.f); add(label1); row().padTop(75.f); add(label2); pack(); setColor(1,0); }
public StartScene(Application app) { setFillParent(true); Label label1; Label label2; if (Gdx.app.getType() != ApplicationType.Android) { label1 = new Label("Press Space or press Left to start the game",app.getGuiSkin()); label2 = new Label("Press Escape to pause the game",app.getGuiSkin()); } else { label1 = new Label("Touch the screen to start the game",app.getGuiSkin()); label2 = new Label("Press the back button to pause the game",app.getGuiSkin()); } add(label1); row().padTop(150.f); add(label2); pack(); }
private void installDesktopGDXDialogs() { if (Gdx.app.getType() != ApplicationType.Desktop) { showDebugSkipInstall(ApplicationType.Desktop.name()); return; } try { final Class<?> dialogManagerClazz = ClassReflection.forName("de.tomgrill.gdxdialogs.desktop.DesktopGDXDialogs"); Object dialogManager = ClassReflection.getConstructor(dialogManagerClazz).newInstance(); this.gdxDialogs = (GDXDialogs) dialogManager; showDebugInstallSuccessful(ApplicationType.Desktop.name()); } catch (ReflectionException e) { showErrorInstall(ApplicationType.Desktop.name(),"desktop"); e.printstacktrace(); } }
private void installHTMLGDXDialogs() { if (Gdx.app.getType() != ApplicationType.WebGL) { showDebugSkipInstall(ApplicationType.WebGL.name()); return; } try { final Class<?> dialogManagerClazz = ClassReflection.forName("de.tomgrill.gdxdialogs.html.HTMLGDXDialogs"); Object dialogManager = ClassReflection.getConstructor(dialogManagerClazz).newInstance(); this.gdxDialogs = (GDXDialogs) dialogManager; showDebugInstallSuccessful(ApplicationType.WebGL.name()); } catch (ReflectionException e) { showErrorInstall(ApplicationType.WebGL.name(),"html"); e.printstacktrace(); } }
public Db() { // deserialize all deFinitions deFinitions = new ObjectMap<>(); Json json = new Json(); json.setIgnoreUnkNownFields(true); for (DeFinitionReference reference : DeFinitionReference.values()) { final String name = reference.id; final FileHandle handle = Gdx.files.external("umbracraft/" + name + ".json"); if (handle.exists() && Gdx.app.getType() == ApplicationType.Desktop) { deFinitions.put(name,json.fromJson(reference.clazz,handle)); } else { final FileHandle internalHandle = Gdx.files.internal("db/" + name + ".json"); if (internalHandle.exists()) { deFinitions.put(name,internalHandle)); } else { try { deFinitions.put(name,reference.clazz.newInstance()); } catch (InstantiationException | illegalaccessexception e) { Game.error("Could not instantiate class: " + reference.clazz); e.printstacktrace(); } } } } }
public void savescoreEtc() { Preferences prefs = Gdx.app.getPreferences(GameSaves); // sum of all scores ever totalscoreSum += currentscore; prefs.putInteger("total_score_sum",totalscoreSum); // games played by player ++totalGamesPlayed; prefs.putInteger("total_games_played",totalGamesPlayed); // save top score if (topscore < currentscore) { topscore = currentscore; // Save top score!!!! prefs.putInteger("topscore",topscore); } // hack / dont want to kill my ssd if (Gdx.app.getType() != ApplicationType.Desktop) { prefs.flush(); } }
@Override public void render(float dt) { Gdx.gl.glClearColor(0,1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //compara si la aplicacion se ejecuta en escritorio o en android if(Gdx.app.getType() == ApplicationType.Desktop){ this.enTradaEscritorio(dt); }else if(Gdx.app.getType() == ApplicationType.Android){ this.enTradaAndroid(dt); } //actualizamos camara.update(); this.juegoGanado(); batch.setProjectionMatrix(camara.combined); manejadorDeSprite.update(dt,arcanoid,jugador); //renderiza el manejadorDeSprite,fondo de pantalla y fuente de jugador batch.begin(); batch.draw(fondoPantalla,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); jugador.draw(batch); batch.end(); manejadorDeSprite.render(); }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,GL20.GL_ONE_MINUS_SRC_ALPHA); String text = "Touch screen to start!"; float width = font.getBounds(text).width; font.draw(spriteBatch,text,240 - width / 2,128); if (Gdx.app.getType() == ApplicationType.WebGL) { text = "Press Enter for Fullscreen Mode"; width = font.getBounds(text).width; font.draw(spriteBatch,"Press Enter for Fullscreen Mode",128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,128 - font.getLineHeight()); } spriteBatch.end(); }
@Override public void create () { Array<Controller> controllers = Controllers.getControllers(); if (controllers.size > 0) { controller = controllers.first(); } Controllers.addListener(controllerListener); setScreen(new MainMenu(this)); music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3",FileType.Internal)); music.setLooping(true); music.play(); Gdx.input.setInputProcessor(new InputAdapter() { @Override public boolean keyUp (int keycode) { if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) { if (!Gdx.graphics.isFullscreen()) Gdx.graphics.setdisplayMode(Gdx.graphics.getdisplayModes()[0]); } return true; } }); fps = new FPSLogger(); }
public float getInputRotation() { float rawRotation = 0f; if (Gdx.app.getType() == ApplicationType.Android) { float added = Prefs.prefs.getFloat("calibratedX",0f); rawRotation = (Gdx.input.getAccelerometerX() - added) * -0.1f; } else if (Gdx.app.getType() == ApplicationType.Desktop) { if (Gdx.input.isKeypressed(Input.Keys.LEFT)) { rawRotation = -0.3f; } else if (Gdx.input.isKeypressed(Input.Keys.RIGHT)) { rawRotation = 0.3f; } } float rotation = 0f; // Don't be too sensitive on the rotation: it only counts if it's above a threshold if (rawRotation > rotationThreshold) { rotation = rawRotation - rotationThreshold; } else if (rawRotation < -rotationThreshold) { rotation = rawRotation + rotationThreshold; } return rotation; }
@Override public void consumeCustomData (int target) { if (!Gdx.graphics.supportsExtension("texture_float")) throw new GdxRuntimeException("Extension OES_TEXTURE_FLOAT not supported!"); // this is a const from GL 3.0,used only on desktops final int GL_RGBA32F = 34836; // GLES and WebGL defines texture format by 3rd and 8th argument,// so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there. if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS || Gdx.app.getType() == ApplicationType.WebGL) { Gdx.gl.glTexImage2D(target,GL20.GL_RGBA,width,height,GL20.GL_FLOAT,buffer); } else { // in desktop OpenGL the texture format is defined only by the third argument,// hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL) Gdx.gl.glTexImage2D(target,GL_RGBA32F,buffer); } }
public static String createPrefix(final Renderable renderable,final Config config) { String prefix = ""; if(Gdx.app.getType() == ApplicationType.Desktop) prefix +="#version 120\n"; else prefix +="#version 100\n"; if(config.type == ParticleType.Billboard){ prefix +="#define billboard\n"; if(config.align == AlignMode.Screen) prefix += "#define screenFacing\n"; else if(config.align == AlignMode.ViewPoint) prefix += "#define viewPointFacing\n"; //else if(config.align == AlignMode.ParticleDirection) // prefix += "#define paticleDirectionFacing\n"; } return prefix; }
@Override public Shader getShader (Renderable renderable) { try { return super.getShader(renderable); } catch (Throwable e) { if (tempFolder != null && Gdx.app.getType() == ApplicationType.Desktop) Gdx.files.absolute(tempFolder).child(name + ".log.txt").writeString(e.getMessage(),false); if (!revert()) { Gdx.app.error("shadercollectionTest",e.getMessage()); throw new GdxRuntimeException("Error creating shader,cannot revert to default shader",e); } error = true; Gdx.app.error("ShaderTest","Could not create shader,reverted to default shader.",e); return super.getShader(renderable); } }
@Override public void create () { super.create(); lights = new Environment(); lights.set(new ColorAttribute(ColorAttribute.AmbientLight,0.1f,1.f)); lights.add(new DirectionalLight().set(0.8f,0.8f,-0.5f,-1.0f,-0.8f)); shaderProvider = new TestShaderProvider(); shaderBatch = new ModelBatch(shaderProvider); cam.position.set(1,1); cam.lookAt(0,0); cam.update(); showAxes = true; onModelClicked("g3d/shapes/teapot.g3dj"); shaderRoot = (hotLoadFolder != null && Gdx.app.getType() == ApplicationType.Desktop) ? Gdx.files.absolute(hotLoadFolder) : Gdx.files.internal("data/g3d/shaders"); }
/** * Sets the up game name. * * @param menu_screen the new up game name */ public void setUpGameName(final MAMainMenuScreen menu_screen) { menu_screen.title = new EmptyActorLight(TITLE_W,TITLE_H,true); menu_screen.title.setTextureRegion(UIAssets.image_main_title,true); menu_screen.title.setorigin( menu_screen.title.getWidth() / 2,menu_screen.title.getHeight() / 2); menu_screen.title.setPosition( AppSettings.SCREEN_W / 2 - menu_screen.title.getWidth() / 2,AppSettings.SCREEN_H + menu_screen.title.getHeight()); if (Gdx.app.getType() == ApplicationType.Android) { menu_screen.title.setPosition( AppSettings.SCREEN_W / 2 - menu_screen.title.getWidth() / 2,AppSettings.SCREEN_H + menu_screen.title.getHeight() - 50); } // menu_screen.getStage().addActor(menu_screen.title); }
/** * Setzen des root-Verzeichnisses. Wird fuer den Zugriff auf Assets * benoetigt. Weiterhin werden die Sound,Music und Texture Pfade gesetzt */ private static void setApplicationRoot() { if (Gdx.app.getType() == ApplicationType.Android) { assetDir = ""; } else if (Gdx.app.getType() == ApplicationType.Desktop) { assetDir = System.getProperty("user.dir") + FILESEParaTOR + "bin" + FILESEParaTOR; } else { Gdx.app.log("AssetManager","No android or desktop device"); } directorySounds = assetDir + FOLDERNAME_SOUNDS; directoryMusic = assetDir + FOLDERNAME_MUSIC; directoryPictures = assetDir + FOLDERNAME_PICTURES; directoryFonts = assetDir + FOLDERNAME_FONTS; }
@Override protected void initShaderProgram() { // Initialise renderer if (Gdx.app.getType() == ApplicationType.WebGL) shaderProgram = new ShaderProgram(Gdx.files.internal("shader/point.vertex.glsl"),Gdx.files.internal("shader/point.fragment.wgl.glsl")); else shaderProgram = new ShaderProgram(Gdx.files.internal("shader/point.vertex.glsl"),Gdx.files.internal("shader/point.fragment.glsl")); if (!shaderProgram.isCompiled()) { Logger.error(this.getClass().getName(),"Pixel shader compilation Failed:\n" + shaderProgram.getLog()); } pointAlpha = new float[] { GlobalConf.scene.POINT_ALPHA_MIN,GlobalConf.scene.POINT_ALPHA_MIN + GlobalConf.scene.POINT_ALPHA_MAX }; shaderProgram.begin(); shaderProgram.setUniform2fv("u_pointAlpha",pointAlpha,2); shaderProgram.end(); }
public FileHandle getUserFile(String filename) { FileHandle file = null; if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) { String dir = Config.getProperty(Config.TITLE_PROP,DESKTOP_PREFS_DIR); dir.replace(" ",""); StringBuilder sb = new StringBuilder(); sb.append(".").append(dir).append("/").append(filename); if (System.getProperty("os.name").toLowerCase().contains("mac") && System.getenv("HOME").contains("Containers")) { file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.toString()); } else { file = Gdx.files.external(sb.toString()); } } else { file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR + filename); } return file; }
public FileHandle getUserFolder() { FileHandle file = null; if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.app.getType() == ApplicationType.Applet) { String dir = Config.getProperty(Config.TITLE_PROP,""); StringBuilder sb = new StringBuilder("."); if (System.getProperty("os.name").toLowerCase().contains("mac") && System.getenv("HOME").contains("Containers")) { file = Gdx.files.absolute(System.getenv("HOME") + "/" + sb.append(dir).toString()); } else { file = Gdx.files.external(sb.append(dir).toString()); } } else { file = Gdx.files.local(NOT_DESKTOP_PREFS_DIR); } return file; }
public DeFinitionDeterminer(){ super(); int w = Gdx.graphics.getWidth(); int h = Gdx.graphics.getHeight(); int m = 0; if(w>h) m = w; else m = h; if(Gdx.app.getType() == ApplicationType.Desktop){ screenType = TextureSize.HIGH; } else if(m <= 480){ screenType = TextureSize.LOW; } else if(m <= 1024){ screenType = TextureSize.MEDIUM; } else { screenType = TextureSize.HIGH; } System.out.println("System screen deFinition : " + screenType.toString()); }
public static FileHandle[] getFontTxtDir() { if (Gdx.app.getType().equals(ApplicationType.Desktop)) { System.out.println(System.getProperty("user.dir") + "\\bin\\fonts\\"); return Gdx.files.absolute( System.getProperty("user.dir") + "\\bin\\fonts\\").list(); } else if (Gdx.app.getType() == ApplicationType.Android) { return Gdx.files.internal("fonts/").list(); } return null; }
@Override public void draw (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); viewMatrix.setToOrtho2D(0,128 - font.getLineHeight()); } spriteBatch.end(); }
今天关于java – weblogic.xml中的错误:cvc-complex-type.2.4.a:找到以元素’prefer-application-packages’开头的无效内容的讲解已经结束,谢谢您的阅读,如果想了解更多关于application.properties 在 maven-compiler-plugin 期间更改、applicationId和packageName,以及在Manifest中使用${applicationId}写法、BEA-141150 - An error occurred while preparing application component uri of application application with HTTP response responseCode: message、com.badlogic.gdx.Application.ApplicationType的实例源码的相关知识,请在本站搜索。
本文标签: