1

I'm trying to use the v8 Renderscript support library, from SDK Build Tools 22.0.0.

I'm using gradle to build, and I've included the lines

defaultConfig {
    renderscriptTargetApi 21
    renderscriptSupportModeEnabled true
}

Importing and using the library seems fine, but when I run my app, it chokes trying to load another shared library, giving an UnsatisfiedLinkError. If I make no other changes except removing the renderscript stuff, there's no linkage problem.

Is there anyway around this? I'm using the SDK tools 22.0.0, gradle 2.2.1, Android Gradle plugin 1.1.0 and Android Studio 1.1.0.

M Dapp
  • 1,453
  • 16
  • 31
  • Can you provide a logcat dump of the error you are seeing? – Larry Schiefer Apr 02 '15 at 02:05
  • I really can't, since it contains proprietary information. But the gist is that, I'm building with a dependency on an AAR library which includes an .so file. Normally, no problem, but with Renderscript support mode enabled, I get an UnsatisfiedLinkError when the application tries to load that .so. Without Renderscript support mode enabled (and even using Renderscript, but not the support library version), the .so loads fine. – M Dapp Apr 02 '15 at 19:44
  • Check to see which symbol it is complaining about (it will say in the log.) Sounds to me like there may be some overlap between what your AAR includes and something the RS support lib uses at the native level. – Larry Schiefer Apr 02 '15 at 20:59

1 Answers1

2

What happened to me was that when I was running on a 64bit device the PathClassLoader found the renderscript library in a 64bit version and thus tried to load 64bit versions of all other libraries included in the project. You can't run mixed 64 and 32bit. But since some of the libraries didn't exist in 64bit versions the PathClassLoader couldn't find them, hence the UnsatisfiedLinkError. The solution that worked for me was to exclude the 64bit versions of the renderscript library.

See this great article to see how its done. Mixing 32- and 64-bit Dependencies in Android

This Stackoverflow post suggests a somewhat simpler solution

Community
  • 1
  • 1
lejonl
  • 1,453
  • 15
  • 20