android - Cocos2D 示例中的 NoClassDefFoundError

标签 android noclassdeffounderror cocos2d-android

我遇到了同样的问题 this question ,但解决方案对我不起作用。我已将我的 JAR 包含在构建路径中。我做错了什么?
我正在使用 same example .

这是崩溃日志:

07-08 04:04:33.440: E/AndroidRuntime(751): FATAL EXCEPTION: main
07-08 04:04:33.440: E/AndroidRuntime(751): java.lang.NoClassDefFoundError: org.cocos2d.opengl.CCGLSurfaceView
07-08 04:04:33.440: E/AndroidRuntime(751):  at a.b.Cocos2DGameActivity.onCreate(Cocos2DGameActivity.java:22)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.Activity.performCreate(Activity.java:4465)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.os.Looper.loop(Looper.java:137)
07-08 04:04:33.440: E/AndroidRuntime(751):  at android.app.ActivityThread.main(ActivityThread.java:4424)
07-08 04:04:33.440: E/AndroidRuntime(751):  at java.lang.reflect.Method.invokeNative(Native Method)
07-08 04:04:33.440: E/AndroidRuntime(751):  at java.lang.reflect.Method.invoke(Method.java:511)
07-08 04:04:33.440: E/AndroidRuntime(751):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-08 04:04:33.440: E/AndroidRuntime(751):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-08 04:04:33.440: E/AndroidRuntime(751):  at dalvik.system.NativeStart.main(Native Method)

最佳答案

我建议您将库更改为 cocos2d-x,因为 cocos2d for android 将不再更新。

Cocos2d-x工作在C++中,使用JNI(Java native interface)工作。这是您开始使用它所需的所有信息。

关于android - Cocos2D 示例中的 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11379246/

相关文章:

java - Android编程(cocos2d),白色矩形代替图像

android - 遍历gridview中的所有对象

java.lang.NoClassDefFoundError : Could not initialize class javax. imageio.ImageIO jboss EAP 6

java - Jdeveloper 启动时错误 "java.lang.NoClassDefFoundError: Could not initialize class oracle.dbtools.raptor.config.DBConfig"

google-app-engine - jTwitter、oAuth 和 Google App Engine。没有发现类定义错误

cocos2d-android - cocos2d中场景和图层的区别

android - 在锁定屏幕顶部显示 View 的标志

android - 如果从 fragment 调用 DialogFragment 抛出 ClassCastException

java - Gradle同步失败: Build tools download failed with code 2

java - cocos2d中无法实例化类型类名