mmin18/RealtimeBlurView

AndroidX app crashed on older Android versions using the library V1.2

chanont-poon opened this issue · 4 comments

I've just updated the library to V1.2 and it still crashes on older Android versions.
Tested on Emulator and phone with Android 5.1.1.
This issue seems to be caused by a bug in androidx.renderscript library itself, as reported in this issue tracker:
https://issuetracker.google.com/issues/119582492

App Config

buildToolsVersion '28.0.3'
defaultConfig {
       minSdkVersion 19
       targetSdkVersion 28
       renderscriptTargetApi 19             // Crashed regardless of adding this config or not
       renderscriptSupportModeEnabled true
   }
Last Exception Backtrace
--
0 | androidx.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/<packagename>-2/lib/arm64/librsjni_androidx.so" Support lib API: 2301
1 | at androidx.renderscript.RenderScript.internalCreate(RenderScript.java:1414)
2 | at androidx.renderscript.RenderScript.create(RenderScript.java:1599)
3 | at androidx.renderscript.RenderScript.create(RenderScript.java:1549)
4 | at androidx.renderscript.RenderScript.create(RenderScript.java:1525)
5 | at androidx.renderscript.RenderScript.create(RenderScript.java:1512)
6 | at com.github.mmin18.widget.AndroidXBlurImpl.prepare(AndroidXBlurImpl.java:20)
7 | at com.github.mmin18.widget.RealtimeBlurView.prepare(RealtimeBlurView.java:186)
8 | at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:206)
9 | at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
10 | at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2144)
11 | at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
12 | at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6243)
13 | at android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
14 | at android.view.Choreographer.doCallbacks(Choreographer.java:586)
15 | at android.view.Choreographer.doFrame(Choreographer.java:556)
16 | at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
17 | at android.os.Handler.handleCallback(Handler.java:739)
18 | at android.os.Handler.dispatchMessage(Handler.java:95)
19 | at android.os.Looper.loop(Looper.java:160)
20 | at android.app.ActivityThread.main(ActivityThread.java:5541)
21 | at java.lang.reflect.Method.invoke(Native Method)
22 | at java.lang.reflect.Method.invoke(Method.java:372)
23 | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
24 | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

Unfortunately, my merge request has not been added, this error is because of not using the base script rendering class in package android.renderscript.*.
The current version now is using androidx or support package, and caused the problem.

I've made some changes, can you try v1.2.1.
@smarteist I didn't merge your code because I want to keep it compatible with both AndroidX and support library.

@mmin18 I've tried v1.2.1, and it seems to have fixed the issue. Thanks for the swift response.

I've made some changes, can you try v1.2.1.
@smarteist I didn't merge your code because I want to keep it compatible with both AndroidX and support library.

Good job , seems to fixed the issue thanks.