[cocos2d-x 3.0] error run a simple hello project on android

With cocos2d-x 3.0rc2, everything’s good (just change 1 line in jnihelper.cpp, in this version this bug has been fixed). But with this version, there’re errors when start app (error: Unfortunately, Hello has been stop)

What i’ve done with cocos console

  1. cocos new …
  2. cocos run …
    result: build success, install success, run success, Starting intent … But simulator appear error mention above

What i’ve done with eclipse

  1. cocos new …
  2. import project to eclipse (…\Hello\proj.android)
  3. import libproject to eclipse (…\Hello\cocos2d\cocos\2d\platform\android\java)
  4. open cmd and navigate to […\Hello\proj.android], type “build_native.py”. No error, file libcocos2dcpp.so has been create in [\Hello\proj.android\libs\armeabi]
    result: like above. below is the main error from logcat
04-25 21:48:10.698: E/Trace(1719): error opening trace file: No such file or directory (2)
04-25 21:48:10.698: D/Cocos2dxActivity(1719): model=Android SDK built for x86
04-25 21:48:10.698: D/Cocos2dxActivity(1719): product=sdk_x86
04-25 21:48:10.698: D/Cocos2dxActivity(1719): isEmulator=true
04-25 21:48:10.708: D/AndroidRuntime(1719): Shutting down VM
04-25 21:48:10.708: W/dalvikvm(1719): threadid=1: thread exiting with uncaught exception (group=0xb4e66288)
04-25 21:48:10.708: E/AndroidRuntime(1719): FATAL EXCEPTION: main
04-25 21:48:10.708: E/AndroidRuntime(1719): java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at java.lang.Runtime.loadLibrary(Runtime.java:365)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at java.lang.System.loadLibrary(System.java:535)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at org.cocos2dx.lib.Cocos2dxHelper.init(Cocos2dxHelper.java:94)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:84)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.Activity.performCreate(Activity.java:5008)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.os.Looper.loop(Looper.java:137)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at android.app.ActivityThread.main(ActivityThread.java:4745)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at java.lang.reflect.Method.invokeNative(Native Method)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at java.lang.reflect.Method.invoke(Method.java:511)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-25 21:48:10.708: E/AndroidRuntime(1719): 	at dalvik.system.NativeStart.main(Native Method)


check this post

[[http://www.cocos2d-x.org/forums/6/topics/37514]]

@lfmingo, Thank for your help, i’ve solved it:)

how do you fix it:(

pls read more this link to understand

but basically, just go to [your gameproject folder]\proj.android\jni\Application.mk and edit it like below
APP_ABI := armeabi armeabi-v7a x86
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -fsigned-char

Btw, the clue for this is:
04-25 21:48:10.698: D/Cocos2dxActivity(1719): model=Android SDK built for x86
04-25 21:48:10.698: D/Cocos2dxActivity(1719): product=sdk_ x86

You almost definitely don’t need both armeabi AND armeabi-v7a but rather just ‘armeabi-v7a’ and you’ll save yourself a lot of compile time and some size in the apk (as it will generate a whole new set of executable code with each architecture you specify and pack it all up)