2

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.

keshav
  • 3,235
  • 1
  • 16
  • 22
android_sh
  • 171
  • 2
  • 12

1 Answers1

2
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.

Iulian
  • 1,156
  • 11
  • 19
  • I have tried with `app-abi=armeabi-v7a armeabi x86 ` It works properly. Could we call like this for multiple architecture ? – android_sh Sep 19 '16 at 07:10
  • `jni/../../../Classes/Menu/MenuScene.h:28: error: undefined reference to 'MenuSce ne::MenuScene()'` I am getting error like this do you have any idea about this ? – android_sh Sep 19 '16 at 08:57
  • Without seeing whats on line 28 and the file contents I can't really say what the problem is. Maybe post the header contents so I can see. – Iulian Sep 19 '16 at 11:53
  • Thank you for help. I have resolve that error, but when I am running this in my device it only seeing blank black screen, nothing happens further. Does this error either for any CPU architecture or anything other. It would be great if you could help me. I am stuck. – android_sh Sep 21 '16 at 05:34
  • This might be a problem in your code, is there any error reported in Logcat? – Iulian Sep 21 '16 at 18:58
  • I have one file named **MenuScene.h**(which giving error in line 28) which create MenuScene. As I have send you previous error it not able to create MenuScene. Code in that Line is `CREATE_FUNC(MenuScene);` – android_sh Sep 22 '16 at 05:15
  • Have you edited Android.mk and included the MenuScene.cpp file in LOCAL_SRC_FILES ? – Iulian Sep 22 '16 at 10:08
  • how to recompile? I have the same issue but changing APP_ABI solves nothing cause it looks like android studio doesn't compile native code at all – fnc12 Dec 21 '16 at 11:49
  • 1
    @fnc12 - you have to compile first in terminal using cocos cli. Try: cocos compile -p android --android-studio --ap android-25 --no-apk and make sure you have android-25 sdk installed in android studio. – Iulian Dec 21 '16 at 19:38