Android - Renderscript Support Library - Error loading RS jni library

I am trying to include a Renderscript support library in my project. I get the following error.

android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Couldn't load rsjni: findLibrary returned null

I do not use jar Renderscript files, I try to use it through Gradle.

Here are my Gradle.build files

TOP LEVEL

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.2.3'
}
}

ext {
compileSdkVersion="Google Inc.:Google APIs:22"
buildToolsVersion="23.0.1"
playStoreMinSdkVersion=16
amazonStoreMinSdkVersion=8
targetSdkVersion=22
versionCode=20
versionName="3.3.0"
runProguard=true
zipAlign=true
proguardConfiguration='../proguard.config'
}

allprojects {
repositories {
    jcenter()
}
}

Application specification

defaultConfig {
    applicationId "**REMOVED**"
    //noinspection GroovyAssignabilityCheck
    targetSdkVersion rootProject.ext.targetSdkVersion
    //noinspection GroovyAssignabilityCheck
    versionCode rootProject.ext.versionCode
    //noinspection GroovyAssignabilityCheck
    versionName rootProject.ext.versionName

    renderscriptTargetApi 23
    renderscriptSupportModeEnabled true
}

Everything that I try to find as possible solutions in stackoverflow does not work. I also included it in the proguard configuration

#RenderScript
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class android.support.v8.renderscript.** { *; }

Editing: here is an implementation in which I really use renderscript, also this is where it calls my application when the call fails.

public static BitmapDrawable Blur ( View view ){

    Bitmap image = GetScreenshot( view );

    int width = Math.round( image.getWidth() * DEFAULT_BITMAP_SCALE );
    int height = Math.round( image.getHeight() * DEFAULT_BITMAP_SCALE );

    Bitmap inputBitmap = Bitmap.createScaledBitmap( image, width, height, false );

    Bitmap outputBitmap = Bitmap.createBitmap( inputBitmap );

    RenderScript rs = RenderScript.create( view.getContext() );
    ScriptIntrinsicBlur intrinsicBlur = ScriptIntrinsicBlur.create( rs, Element.U8_4(rs) );

    Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
    Allocation tmpOut = Allocation.createFromBitmap( rs, outputBitmap );

    intrinsicBlur.setRadius( DEFAULT_BLUR_RADIUS );
    intrinsicBlur.setInput( tmpIn );
    intrinsicBlur.forEach( tmpOut );

    tmpOut.copyTo( outputBitmap );

    inputBitmap.recycle();
    rs.destroy();

    return new BitmapDrawable( outputBitmap );
}

This is the exact line.

RenderScript rs = RenderScript.create( view.getContext() );
+3
source share
2 answers

, Renderscript armeabi. , Renderscript :

System.getProperty("os.arch");

, Android, :

armeabi-v7a. .

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

: Renderscript armeabi, Bitmap.createScaledBitmap filter true.

+8

, , apk, lib. lib , (arm64-v8a, armeabi, armeabi-v7a, mips, x86 ..).

, , Renderscript.

Renderscript -

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
 }
+1

Source: https://habr.com/ru/post/1615779/


All Articles