androidcocoaandroid-studiococos2d-xcocos2d-android

Error while running cocoa2dx project


Manifest

<application android:label="@string/app_name" 
android:allowBackup="true" android:icon="@mipmap/ic_launcher"> 
<!-- Tell Cocos2dxActivity the name of our .so --> 
<meta-data android:name="android.app.lib_name" android:value="MyGame" />
<activity ............../> </intent-filter> </activity> 
</application>

Error:

com.xxx.xxxxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xxx.xxxxxxx, PID: 15913 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xxx.xxxxx-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] 
>couldn't find "libMyGame.so"                                      at java.lang.Runtime.loadLibrary(Runtime.java:366)
                                                                   at java.lang.System.loadLibrary(System.java:989)
                                                                   at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
                                                                   at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
                                                                   at android.app.Activity.performCreate(Activity.java:5966)
                                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
                                                                   at android.app.ActivityThread.access$800(ActivityThread.java:162)
                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                   at android.os.Looper.loop(Looper.java:189)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:5532)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at java.lang.reflect.Method.invoke(Method.java:372)
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)

it redirect me in file

Cocos2dxActivity.java:248 in code line System.loadLibrary(libName);

I am stuck with this error. Help me.

I am using cocos2d-x-3.13

Android NDK, Revision 12 
Latest SDK
Android-studio 2.1.3
python 2.7.12
apache-ant 1.9.7
JDK 1.8

Thanks in advance.


Solution

  • couldn't find "libMyGame.so"
    

    This error happens because you didn't compiled for the architecture you are trying to test on.

    Change to this in Application.mk file:

    APP_ABI := armeabi armeabi-v7a x86
    

    Then recompile and test.