Cocos2d-x 3.11 Android Error help needed

Hi,

we using cocos2d-x 3.11 and NDK 10, compiling against SDK 22 min SDK version 15 we getting following error for some users, can someone explain what wrong there.

java.lang.ExceptionInInitializerError
	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:267)
	at org.cocos2dx.cpp.AppActivity.onCreate(AppActivity.java:82)
	at android.app.Activity.performCreate(Activity.java:5015)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2057)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2118)
	at android.app.ActivityThread.access$700(ActivityThread.java:136)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4903)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.cocos2dx.lib.Cocos2dxHelper$1
	at org.cocos2dx.lib.Cocos2dxHelper.<clinit>(Cocos2dxHelper.java:121)
	... 16 more


java.lang.NoClassDefFoundError: org.cocos2dx.lib.Cocos2dxHelper$1
	at org.cocos2dx.lib.Cocos2dxHelper.<clinit>(Cocos2dxHelper.java:121)
	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:267)
	at org.cocos2dx.cpp.AppActivity.onCreate(AppActivity.java:82)
	at android.app.Activity.performCreate(Activity.java:5451)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2386)
	at android.app.ActivityThread.access$900(ActivityThread.java:169)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5476)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
	at dalvik.system.NativeStart.main(Native Method)

seems found what caused that error - it was happening due multidex bot properly enabled - so be aware :slight_smile:

How did you enable multidex?

Hi, I’m used this tutorial for gradle:

https://developer.android.com/studio/build/multidex.html

Our app missed that part in Android manifest due it crashed on Android 4.x devices:



Good to know, i haven’t used this feature. So need to disable or enable it to fix the issue?

Multidex with SDKBOX should be enabled as there is to many methods, but in this case you
need also to add to android manifest tag android:name=“android.support.multidex.MultiDexApplication” otherwise on older devices it will crash.

What devices did you test on? I will try to reproduce it, then i can make sure that the issue is fixed.

We have samsung s3 with android 4.3