0

遵循此链接中的我的第一个三角形教程:我的第一个三角形

桌面版本工作得很好,但是当我部署 android 模拟器版本时,我得到了这个错误:

Unfortunately, MyFirstTriangleAndroid has stopped. 

有什么建议可以帮助解决这个问题吗?我正在使用 libgdx-0.9.4。

这是目录:

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
4

1 回答 1

4

这个教程有点过时了。Google 决定更改引用依赖项的方式,您需要转到 Android 项目的属性 -> Java 构建路径 -> 订单和导出选项卡,并确保所有内容都已导出(选中复选框)。

我强烈建议阅读这篇新文章,详细介绍在 Eclipse 中设置 libgdx 项目所需的步骤:http ://code.google.com/p/libgdx/wiki/ProjectSetupNew?ts=1339344711&updated=ProjectSetupNew

此外,我建议您阅读新的开发人员指南 wiki 文章,这里是目录:http ://code.google.com/p/libgdx/wiki/TableOfContents?tm=6

于 2012-06-10T16:13:40.587 回答