Android NDK java.lang.UnsatisfiedLinkError: findLibrary returned null

后端 未结 16 690
我在风中等你
我在风中等你 2020-11-30 01:56

Having the above error in your Android JNI app? Read on...

Up front, I\'ll say that I\'ve already solved this, in my own way, but I feel something in the Android bu

16条回答
  •  囚心锁ツ
    2020-11-30 02:11

    First, check you have the jni files inside you libs folder in eclipse or jniLibs folder in android studio. When you checkin in any svn, cross check to check in the .so files too.

    My Scenario was when Building with Android studio.

    When you are building in android studio, your library .so files or (jni) files should be inside the \src\main\jniLibs\armeabi***.so folder.

    where as these files will be inside the \libs\armeabi***.so in eclipse.

    When building using both eclipse and android studio, you have to modify your build.gradle file as

    main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                aidl.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                res.srcDirs = ['res']
                assets.srcDirs = ['assets']
    
                // Fixed Issue : "android studio java.lang.unsatisfiedlinkerror: couldn't load find library returned null"
                // Cause : For android studio : The JNI files should be placed in the /src/main/jniLibs folder.
                // Fix : Mapping the jniLibs 's source Directories with Lib's folder
                jniLibs.srcDirs = ['libs']
    }
    

    Here I am building the project using both the android studio and the eclipse.

提交回复
热议问题