Search code examples
androidandroid-studiogradlejava-native-interfacerenderscript

Enabling of renderscript makes app to ignore jniLibs


I want to use some jni libraries. So I put binaries like this:

project
-app
--jnilibs
---armeabi
----libqwerty.so

and in my build.gradle (app module):

sourceSets.main {
    jniLibs.srcDirs = ['jniLibs']
}

it works as expected, however when I add renderscript to my project:

renderscriptTargetApi 22
renderscriptSupportModeEnabled true

application doesn't see my jniLibs directory anymore. And the content of getApplicationInfo().nativeLibraryDir is: [libRSSupport.so, librsjni.so]

UPDATE: ok, I was able to resolve this issue with just renaming directory armeabi to armeabi-v7a. However what if I want to support some other cpu-architectures?


Solution

  • See the answer by a Google developer: renderscript libraries are not supported for Arm v6 and they have no plans to port them back. As for x86, MIPS, and 64-bit versions, Gradle will automagically add appropriate RS binaries to your APK.