Can not find .so file on 64 bit android device

陌路散爱 提交于 2019-12-06 05:48:23

问题


Using aviary android sdk using android studio and gradle build. App generated running fine on all devices having 32 bit architecture.

Same app is giving following error in the 64 bit device [Eg. Sony C4]

    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file 
"/data/app/com.myapp/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libaviary_moalite.so"

gredle.build part

dependencies {
    ...
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.facebook.fresco:fresco:0.8.1+'
    compile 'com.facebook.fresco:imagepipeline-okhttp:0.8.1+'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.adobe.creativesdk:image:4.0.0'
}

Reference That did not worked

Can't find ARM64 NDK native lib using Android Studio (1.3 RC)

Same error if use any of solution used.

How to use 32-bit native libraries on 64-bit Android device

Getting error like

Error:(16, 0) Error: NDK integration is deprecated in the current plugin.  Consider trying the new experimental plugin.  For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental.  Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.

I am not sure what wrong I am doing or it is not supported at all.


回答1:


It looks like some of the packages you use come with 64-bit libraries, but some don't. To keep your APK 32-bit only, I use

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

You can play with include 'armeabi' too, if it is relevant.




回答2:


I've solved this case by the following steps:

  1. I've moved armeabi and x86 folders from: \src\main\jniLibs to: \libs

    Please make sure to move all the files under those folders as well: *.so files should be located there.

  2. I've added the following to my build.gradle:

    sourceSets.main {
      jniLibs.srcDir 'src/main/libs'
    }
    
  3. Clean + rebuild the project

    *in case you are using multidex, please verify that these lines were added to build.gradle:

    defaultConfig {
      multiDexEnabled true
    }
    
    dexOptions {
      preDexLibraries false
      javaMaxHeapSize "4g"
    }
    

In addition, this should be added inside your manifest file:

<application
    android:name="android.support.multidex.MultiDexApplication">
/application>

Hope this helps.



来源:https://stackoverflow.com/questions/33915850/can-not-find-so-file-on-64-bit-android-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!