我正在使用libGDX
为Android和台式机创建游戏。对于过渡屏幕,我正在使用Universal Tween engine
。桌面版本运行完美,但每当我尝试运行Android版本时,我都会得到Fatal Exception
。 NoClassDefFound
类的SpriteTween
异常发生,但它存在并在我的桌面游戏中成功检测到。
03-03 11:04:17.192: I/System.out(21831): TOUCHED
03-03 11:04:19.264: I/System.out(21831): Click: Level2
03-03 11:04:19.264: I/dalvikvm(21831): Could not find method aurelienribon.tweenengine.TweenManager.update, referenced from method com.DC.my_packet_journey.TransitionScreen2.render
03-03 11:04:19.264: W/dalvikvm(21831): VFY: unable to resolve virtual method 241: Laurelienribon/tweenengine/TweenManager;.update (F)V
03-03 11:04:19.264: D/dalvikvm(21831): VFY: replacing opcode 0x6e at 0x0011
03-03 11:04:19.264: I/dalvikvm(21831): Failed resolving Lcom/DC/my_packet_journey/SpriteTween; interface 88 'Laurelienribon/tweenengine/TweenAccessor;'
03-03 11:04:19.264: W/dalvikvm(21831): Link of class 'Lcom/DC/my_packet_journey/SpriteTween;' failed
03-03 11:04:19.264: E/dalvikvm(21831): Could not find class 'com.DC.my_packet_journey.SpriteTween', referenced from method com.DC.my_packet_journey.TransitionScreen2.show
03-03 11:04:19.264: W/dalvikvm(21831): VFY: unable to resolve new-instance 127 (Lcom/DC/my_packet_journey/SpriteTween;) in Lcom/DC/my_packet_journey/TransitionScreen2;
03-03 11:04:19.264: D/dalvikvm(21831): VFY: replacing opcode 0x22 at 0x004a
03-03 11:04:19.264: I/dalvikvm(21831): Failed resolving Lcom/DC/my_packet_journey/SpriteTween; interface 88 'Laurelienribon/tweenengine/TweenAccessor;'
03-03 11:04:19.264: W/dalvikvm(21831): Link of class 'Lcom/DC/my_packet_journey/SpriteTween;' failed
03-03 11:04:19.264: D/dalvikvm(21831): DexOpt: unable to opt direct call 0x01f2 at 0x4c in Lcom/DC/my_packet_journey/TransitionScreen2;.show
03-03 11:04:19.274: D/dalvikvm(21831): DexOpt: unable to opt direct call 0x00f0 at 0x54 in Lcom/DC/my_packet_journey/TransitionScreen2;.show
03-03 11:04:19.274: I/dalvikvm(21831): Failed resolving Lcom/DC/my_packet_journey/TransitionScreen2$1; interface 89 'Laurelienribon/tweenengine/TweenCallback;'
03-03 11:04:19.274: W/dalvikvm(21831): Link of class 'Lcom/DC/my_packet_journey/TransitionScreen2$1;' failed
03-03 11:04:19.274: D/dalvikvm(21831): DexOpt: unable to opt direct call 0x0261 at 0x5b in Lcom/DC/my_packet_journey/TransitionScreen2;.show
03-03 11:04:19.274: I/dalvikvm(21831): DexOpt: unable to optimize static field ref 0x000b at 0x6a in Lcom/DC/my_packet_journey/TransitionScreen2;.show
03-03 11:04:19.304: W/dalvikvm(21831): threadid=11: thread exiting with uncaught exception (group=0x41dfe8b0)
03-03 10:35:23.918: E/AndroidRuntime(20079): FATAL EXCEPTION: GLThread 14763
03-03 10:35:23.918: E/AndroidRuntime(20079): java.lang.NoClassDefFoundError: com.DC.my_packet_journey.SpriteTween
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.DC.my_packet_journey.TransitionScreen5.show(TransitionScreen5.java:67)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.Game.setScreen(Game.java:62)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.DC.my_packet_journey.PagedScrollPaneTest$1.clicked(PagedScrollPaneTest.java:226)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:84)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:57)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:343)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.backends.android.AndroidInput.processEvents(AndroidInput.java:360)
03-03 10:35:23.918: E/AndroidRuntime(20079): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:498)
03-03 10:35:23.918: E/AndroidRuntime(20079): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
03-03 10:35:23.918: E/AndroidRuntime(20079): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
LibGDX对这两个版本使用相同的基本代码。所以从技术上讲,如果桌面版本有效,那么Android版本也可以正常工作。
我已经从logCat中添加了更多条目,我想这一切都是由于SpriteTween的Link类失败而发生的。为什么这只发生在android?
答案 0 :(得分:1)
我提到了这个问题here。事实证明,在我的android项目buildpath> order&导出android 4.0.3
标记未选中。通过检查该框,我的问题得到了解决。
与提到的stuntmania
一样,问题不在于补间引擎,而在于我的构建路径。 dalvik机器无法检测到适当的库,因此只有android版本在桌面版本运行完美时无效。