0xC0DED00D
0xC0DED00D

Reputation: 20348

NoClassDefFoundError in Cocos2D sample

I am getting the same problem this question, but the solution didn't work for me. I've included my JAR in build path. What wrong am I doing?
I am using the same example.

Here's the crash log:

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)

Upvotes: 4

Views: 1046

Answers (3)

rogge
rogge

Reputation: 11

I get the same problem. And I copy the source code to src instead of including the jar. And you must change the project's jre version to 1.6

Upvotes: 1

0xC0DED00D
0xC0DED00D

Reputation: 20348

I guess the problem was in the JAR file. Fortunately the project is open source, so I added the source file and it stopped giving me error. There's a source code available on that tutorial which also uses the source files, instead of the JAR.

Upvotes: 1

vgonisanz
vgonisanz

Reputation: 11930

I recomend you to change libraries to cocos2d-x, because cocos2d for android won't be updated anymore.

Cocos2d-x works in C++, and uses JNI (Java native interface) to work. Here is all the info you will need to start using it.

Upvotes: 4

Related Questions