Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renderscript broken with AndroidX?

Since I've migrated to androidx I can't make Renderscript run. I'm getting following exception:

2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "android.support.v8.renderscript.RenderScript" on path: DexPathList[[zip file "/data/app/pl.qus.xenoamp2-xHJAddeg9oM-uGSxlvMp7A==/base.apk"],nativeLibraryDirectories=[/data/app/pl.qus.xenoamp2-xHJAddeg9oM-uGSxlvMp7A==/lib/arm64, /data/app/pl.qus.xenoamp2-xHJAddeg9oM-uGSxlvMp7A==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1099) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.String) (Runtime.java:1014) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at void java.lang.System.loadLibrary(java.lang.String) (System.java:1657) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at androidx.renderscript.RenderScript androidx.renderscript.RenderScript.internalCreate(android.content.Context, int, androidx.renderscript.RenderScript$ContextType, int) (RenderScript.java:1408) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at androidx.renderscript.RenderScript androidx.renderscript.RenderScript.create(android.content.Context, int, androidx.renderscript.RenderScript$ContextType, int) (RenderScript.java:1599) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at androidx.renderscript.RenderScript androidx.renderscript.RenderScript.create(android.content.Context, androidx.renderscript.RenderScript$ContextType, int) (RenderScript.java:1549) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at androidx.renderscript.RenderScript androidx.renderscript.RenderScript.create(android.content.Context, androidx.renderscript.RenderScript$ContextType) (RenderScript.java:1525) 2018-10-12 16:27:58.328 27195-27195/pl.qus.xenoamp2 A/zygote64: java_vm_ext.cc:504] at androidx.renderscript.RenderScript androidx.renderscript.RenderScript.create(android.content.Context) (RenderScript.java:1512)

I have usual entries in gradle:

    renderscriptTargetApi 18
    renderscriptSupportModeEnabled true

Anything else I have to change?

like image 233
ssuukk Avatar asked Oct 12 '18 14:10

ssuukk


2 Answers

I had the same issue, i switched to non support version of renderscript

In project gradle

renderscriptTargetApi 17
renderscriptSupportModeEnabled false

And in the class that use renderscript

import android.renderscript.RenderScript

instead of

import androidx.renderscript.RenderScript

It did the job for me but i don't like this solution, to be completed

like image 106
Rubens bambidotexe Nunzi Avatar answered Oct 12 '22 17:10

Rubens bambidotexe Nunzi


There was an issue with the build tools (the prebuilt librsjni_androidx.so, to be exact), and is now fixed in version 29.0.2.

I've verified this by upgrading compile sdk to API 29 and build tools to 29.0.2.

Edit: This is what I've configured in build.gradle:

    renderscriptTargetApi 18
    renderscriptSupportModeEnabled true
like image 38
bosphere Avatar answered Oct 12 '22 17:10

bosphere