我正在使用libGDX
爲Android和臺式電腦創建遊戲。對於轉換屏幕,我正在使用Universal Tween engine
。桌面版本運行完美,但每當我嘗試運行Android版本,我得到Fatal Exception
。 NoClassDefFound
對於SpriteTween
類有例外,但它存在並且在我的桌面遊戲中成功檢測到。Eclipse dalvik'吐溫引擎'類的鏈接在Android上失敗,但在桌面上工作
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類而發生的。爲什麼這隻發生在android上?
這不應該發生。你有合適的圖書館出口嗎?您是否在項目中複製了圖書館? – Ferdz
我還沒有導出它,我只是在我的設備上運行它來檢查它是否工作。我已經在我的構建路徑中添加了這些庫,但我沒有將它們複製粘貼到我的項目文件夾中。 –
那麼也許這就是你的問題。我所做的是在我的項目中創建一個名爲libs的文件夾,並將其中的所有庫複製粘貼。然後,當我創建構建路徑時,我將這些庫引用到項目中。但一旦出口,我認爲這沒什麼區別。我只是把它扔在那裏。 – Ferdz