Android - Renderscript Support Library - Error loading RS jni library

筅森魡賤 提交于 2019-11-30 15:51:50

Unfortunately Renderscript is not available for the armeabi architecture. The bright side is that you can check at runtime to see the architecture of the device and not run the Renderscript code on those devices:

System.getProperty("os.arch");

There is also an issue open on the android bug tracker, where they state:

We only ship the support library for armeabi-v7a. This is a known limitation.

https://code.google.com/p/android/issues/detail?id=68520

Edit: If you want to implement a blur without Renderscript on armeabi devices, you can simply downscale the image with Bitmap.createScaledBitmap setting filter to true.

In general, you can solve that by unzipping your apk file, then check lib folder. lib folder contains native libraries grouped by different system architectures (arm64-v8a, armeabi, armeabi-v7a, mips, x86, etc).

Sometimes some libraries exist only for some system architectures not all architectures, so you need to check system architecture first before using any code from this native library for example Renderscript support library.

For Renderscript exception, you can do something like that

ArrayList<String> abis = new ArrayList<>();

 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
   abis.add(Build.CPU_ABI);
 } else {
    for (String abi : Build.SUPPORTED_ABIS) {
        abis.add(abi);
    }
 }

 if (abis.contains("x86") || abis.contains("mips") || abis.contains("armeabi-v7a")) {
   // do Renderscript stuff
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!