问题描述
随着从这个链接我的第一个三角形教程:
此外,我建议通过新的开发人员指南维基文章去,这里是表的内容:http://$c$c.google.com/p/libgdx/wiki/TableOfContents?tm=6
Following the My First Triangle tutorial from this link: My First Triangle
the desktop version works perfectly fine, however when i deploy the android emulator version i get this error:
Unfortunately, MyFirstTriangleAndroid has stopped.
Any suggestions to help fix this problem? I'm using libgdx-0.9.4.
here is the catlog:
06-10 15:32:00.623: D/dalvikvm(528): Not late-enabling CheckJNI (already on)
06-10 15:32:01.653: E/dalvikvm(528): Could not find class 'com.test.myfirsttriangle.MyFirstTriangle', referenced from method com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate
06-10 15:32:01.653: W/dalvikvm(528): VFY: unable to resolve new-instance 684 (Lcom/test/myfirsttriangle/MyFirstTriangle;) in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;
06-10 15:32:01.653: D/dalvikvm(528): VFY: replacing opcode 0x22 at 0x0003
06-10 15:32:01.653: D/dalvikvm(528): DexOpt: unable to opt direct call 0x1c88 at 0x05 in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;.onCreate
06-10 15:32:01.713: D/dalvikvm(528): Trying to load lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): Added shared lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): No JNI_OnLoad found in /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8, skipping init
06-10 15:32:01.783: D/AndroidRuntime(528): Shutting down VM
06-10 15:32:01.783: W/dalvikvm(528): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-10 15:32:01.793: E/AndroidRuntime(528): FATAL EXCEPTION: main
06-10 15:32:01.793: E/AndroidRuntime(528): java.lang.NoClassDefFoundError: com.test.myfirsttriangle.MyFirstTriangle
06-10 15:32:01.793: E/AndroidRuntime(528): at com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate(MyFirstTriangleAndroidActivity.java:11)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Activity.performCreate(Activity.java:4465)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Looper.loop(Looper.java:137)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 15:32:01.793: E/AndroidRuntime(528): at dalvik.system.NativeStart.main(Native Method)
06-10 15:32:06.703: I/Process(528): Sending signal. PID: 528 SIG: 9
This tutorial is kind of outdated. Google decided to change the way dependencies are referenced, you need to go to your Android project's properties -> Java Build Path -> Order & Export tab, and make sure everything is exported (check the boxes).
I'd highly recommend reading this new article detailing the steps required to setup a libgdx project in Eclipse: http://code.google.com/p/libgdx/wiki/ProjectSetupNew?ts=1339344711&updated=ProjectSetupNew
Additionally i'd recommend going through the new developer guide wiki articles, here is the table of contents: http://code.google.com/p/libgdx/wiki/TableOfContents?tm=6
这篇关于libgdx我的第一个三角形的教程不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!