Android Studio java.lang.ExceptionInInitializeError调用静态游戏资源以绘制时出错
我已经为一款LIBGDX游戏工作了一段时间,上周我将我的Android Studio更新为2.1.2版。更新之后,当screen类中的render方法尝试绘制从其他类调用的静态图像时,我开始获取Android Studio java.lang.ExceptionInInitializeError调用静态游戏资源以绘制时出错,java,android,static,libgdx,Java,Android,Static,Libgdx,我已经为一款LIBGDX游戏工作了一段时间,上周我将我的Android Studio更新为2.1.2版。更新之后,当screen类中的render方法尝试绘制从其他类调用的静态图像时,我开始获取java.lang.ExceptionInInitializerError。 " batcher.begin(); 配料机绘图(资产:rockWall,0,0,160,90); " 这是我的错误日志: 07-24 12:12:10.7029442-9489/?E/AndroidRuntime:致命异常:
java.lang.ExceptionInInitializerError
。
"
batcher.begin();
配料机绘图(资产:rockWall,0,0,160,90);
"
这是我的错误日志:
07-24 12:12:10.7029442-9489/?E/AndroidRuntime:致命异常:
GL32587
进程:com.dotabmot.game,PID:9442
java.lang.ExceptionInInitializeError
位于com.dotabmot.game.StartMenuScreen.render(StartMenuScreen.java:108)
位于com.badlogic.gdx.Game.render(Game.java:46)
位于com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:474)
位于android.opengl.GLSurfaceView$GLThread.guarderun(GLSurfaceView.java:1531)
位于android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
原因:com.badlogic.gdx.utils.GdxRuntimeException:无法加载文件:
trollWalk1.png
在com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:148)
位于com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:100)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:92)
位于com.dotabmot.game.Assets。(Assets.java:112)
位于com.dotabmot.game.StartMenuScreen.render(StartMenuScreen.java:108)
位于com.badlogic.gdx.Game.render(Game.java:46)
位于com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:474)
位于android.opengl.GLSurfaceView$GLThread.guarderun(GLSurfaceView.java:1531)
位于android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
原因:com.badlogic.gdx.utils.GdxRuntimeException:读取文件时出错:
trollWalk1.png(内部)
位于com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
位于com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
在com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:145)
位于com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:100)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:92)
位于com.dotabmot.game.Assets。(Assets.java:112)
位于com.dotabmot.game.StartMenuScreen.render(StartMenuScreen.java:108)
位于com.badlogic.gdx.Game.render(Game.java:46)
位于com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:474)
位于android.opengl.GLSurfaceView$GLThread.guarderun(GLSurfaceView.java:1531)
位于android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
原因:java.io.FileNotFoundException:trollWalk1.png
位于android.content.res.AssetManager.openAsset(本机方法)
位于android.content.res.AssetManager.open(AssetManager.java:324)
位于android.content.res.AssetManager.open(AssetManager.java:298)
位于com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:75)
位于com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
在com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:145)
位于com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:100)
位于com.badlogic.gdx.graphics.Texture.(Texture.java:92)
位于com.dotabmot.game.Assets。(Assets.java:112)
位于com.dotabmot.game.StartMenuScreen.render(StartMenuScreen.java:108)
位于com.badlogic.gdx.Game.render(Game.java:46)
// The Rock Wall Background
public static Texture textureRockWall = new Texture(Gdx.files.internal("rockWall.jpg"));
public static TextureRegion rockWall = new TextureRegion(textureRockWall, 0, 0, 600, 450);
// The New Game Button
public static Texture textureNewGameButton = new Texture(Gdx.files.internal("newGameButton.png"));
public static TextureRegion newGameButton = new TextureRegion(textureNewGameButton, 0, 0, 139, 351);
// Draw Background Rock Wall
batcher.begin();
batcher.draw(Assets.rockWall, 0, 0, 160, 90); **// THIS LINE IS WHERE I GET THE ERROR. IF I REMOVE THIS LINE I GET THE SAME ERROR FOR THE NEXT STATIC OBJECT WHICH IS Assets.newGameButtonClicked...**
//Screen1
if(screen1) {
if(!StartMenuScreenInputHandler.newGameButtonClicked) {
batcher.draw(Assets.newGameButton, 50, 15, 15, 60);
} else if(StartMenuScreenInputHandler.newGameButtonClicked){
batcher.draw(Assets.newGameButtonP, 50, 15, 15, 60);
if(goAhead){
goAhead = false;
StartMenuScreenInputHandler.newGameButtonClicked = false;
buttonCounter = 0;
screen1 = false;
screen2 = true;
}
}
Caused by: java.io.FileNotFoundException: trollWalk1.png