java.lang.UnsatisfiedLinkError couldn't find "libMyGame.so" when compile Android Studio Project

java.lang.UnsatisfiedLinkError couldn't find "libMyGame.so" when compile Android Studio Project
0.0 0

#1

The game runs fine if I compile and run using the following:
cocos compile -p android --android-studio
cocos run -p android --android-studio

If I run the game from the Android Studio (Run Button), or cocos run -p android --android-studio
The code compiles without any errors, but when I run the game, it crashes instantly.

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.scp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.csp-1/lib/arm64, /data/app/com.scp-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libMyGame.so"

I’ve changed the Application.mk a few times (located in: proj.androidn-studio/app/jni/Application.mk:
APP_ABI := armeabi and APP_ABI := armeabi-v7a

But it always crashes for the same reason.

I’m not sure if it have anything to do with this error, but I’m implementing fyber so I’ve made some changes to build.gradle (Module:cp)

repositories {
    maven {
        name "Fyber's maven repo"
        url "https://fyber.bintray.com/maven"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libcocos2dx')
    compile 'com.fyber.mediation:admob:9.6.1-r1@aar'
    compile 'com.fyber.mediation:adcolony:3.0.4-r1@aar'
}

What am I doing wrong?


#2

I have exactly the same issue, did you resolve it? Thanks.


#3

Same problem here


#5

From what I can see u compiling only for one of this architectures for armeabi or armeabi-v7a ? But in your crash log it trying to access arm64 - which means you have 64bit phone and in build is included some arm64 libraries, so phone thinking it was compiled for arm64 and when trying to run in 64bit mode crashing due compiled with armeabi

I’m assuming u need to put in gradle Android part:

splits {
    abi {
        enable true
        reset()
        include 'armeabi-v7a'
        universalApk false
    }
}

It will exlucde all libs which not belongs to armeabi-v7a - depends on your compiled architecture