qhutch / ElevationImageView

Imageview with elevation shadow
396 stars 46 forks source link

App crashing on Android 5.1 #21

Open Aqua-Ye opened 5 years ago

Aqua-Ye commented 5 years ago

Here is the logs:

09-11 14:37:14.520 6585-6585/com.qhutch.shadowimageview E/art: Failed to register native method in androidx.renderscript.RenderScript in /data/app/com.qhutch.shadowimageview-2/base.apk: method name is null at index 0
09-11 14:37:14.520 6585-6585/com.qhutch.shadowimageview E/RenderScript_jni: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.qhutch.shadowimageview-2/lib/x86_64/librsjni_androidx.so"
09-11 14:37:14.520 6585-6585/com.qhutch.shadowimageview D/AndroidRuntime: Shutting down VM
09-11 14:37:14.521 6585-6585/com.qhutch.shadowimageview E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.qhutch.shadowimageview, PID: 6585
    androidx.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.qhutch.shadowimageview-2/lib/x86_64/librsjni_androidx.so" Support lib API: 2301
        at androidx.renderscript.RenderScript.internalCreate(RenderScript.java:1414)
        at androidx.renderscript.RenderScript.create(RenderScript.java:1599)
        at androidx.renderscript.RenderScript.create(RenderScript.java:1549)
        at androidx.renderscript.RenderScript.create(RenderScript.java:1525)
        at androidx.renderscript.RenderScript.create(RenderScript.java:1512)
        at com.qhutch.elevationimageview.ElevationImageView.onAttachedToWindow(ElevationImageView.kt:136)
        at android.view.View.dispatchAttachedToWindow(View.java:13525)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2695)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1299)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
        at android.view.Choreographer.doCallbacks(Choreographer.java:580)
        at android.view.Choreographer.doFrame(Choreographer.java:550)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
09-11 14:37:20.339 6585-6596/com.qhutch.shadowimageview E/System: Uncaught exception thrown by finalizer
09-11 14:37:20.339 6585-6596/com.qhutch.shadowimageview E/System: androidx.renderscript.RSInvalidStateException: Calling RS with no Context active.
        at androidx.renderscript.RenderScript.validate(RenderScript.java:1237)
        at androidx.renderscript.RenderScript.nContextFinish(RenderScript.java:332)
        at androidx.renderscript.RenderScript.helpDestroy(RenderScript.java:1680)
        at androidx.renderscript.RenderScript.finalize(RenderScript.java:1714)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:191)
        at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:174)
        at java.lang.Thread.run(Thread.java:818)
Aqua-Ye commented 5 years ago

potentially related: https://stackoverflow.com/questions/52781821/renderscript-broken-with-androidx

Damien-L commented 4 years ago

I had a strange problem on Android 5.0 : crash of the app but no stacktrace. Probably a crash in a low graphic layer. Adding "buildToolsVersion" on my config solve the problem. I don't know why. See my config below. Maybe this will work for you.

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true