2

i am creating a game using libGDX for android and desktop PCs. For transition screens, I am making use of Universal Tween engine. The desktop version runs perfectly but whenever I try running the android version, I get a Fatal Exception. The exception occurs as NoClassDefFoundfor SpriteTween class but it exists and is successfully detected in my desktop game.

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 makes use of same base code for either version. So technically if the desktop version works, the android version should work as well.

I have added more entries from the logCat, I suppose all this is happening due to failed to Link class of SpriteTween. Why is this only happening on android?

Ab5
  • 606
  • 9
  • 25
  • This shouldn't happen. Did you export with the proper library? Did you copy-pasted the library in the project? – Ferdz Mar 03 '14 at 05:22
  • I havent exported it as yet, I am simply running it on my device to check if its working.I have added the libraries in my build paths but I have not copy-pasted them in my project folder. – Ab5 Mar 03 '14 at 05:24
  • Then maybe that's your problem. What I do is I create a folder inside my project called libs, and copy paste all of my libraries inside it. Then, when I create the build path, I refer the libraries inside the project. But once it's exported, I don't think it makes any difference. I was just throwing that out there. – Ferdz Mar 03 '14 at 05:30
  • Ok , I will try your way and see if it works – Ab5 Mar 03 '14 at 05:31
  • @stuntmania sorry, but it did not work. I still get the exception `NoClassDefFound` but only on android. – Ab5 Mar 03 '14 at 05:37
  • Alright well basically what this line means: `03-03 10:35:23.918: E/AndroidRuntime(20079): java.lang.NoClassDefFoundError: com.DC.my_packet_journey.SpriteTween ` is that it cannot find SpriteTween's class. This might have nothing to do with TweenEngine after all. Make sure your SpriteTween.class is saved. What is weird is that it works on windows. How do you install it on your android device? Are you sure you have all the compiled classes in there? – Ferdz Mar 03 '14 at 05:50
  • @stuntmania thnks but I found out the problem. As you rightly mentioned , the problem is not with the tween engine but in my build path. – Ab5 Mar 03 '14 at 06:11

1 Answers1

1

I referred this question here. Turns out that in my android project buildpath>order & export the android 4.0.3 tag was unchecked. By checking that box, my problem was solved.

Like stuntmania mentioned, the problem was not with the tween engine but in my build path. The dalvik machine failed to detect appropriate libraries and hence only the android version was not working while the desktop version was running perfectly.

build path

Community
  • 1
  • 1
Ab5
  • 606
  • 9
  • 25