androidproguardandroid-support-libraryrenderscript

minifiedEnabled leads to renderscript crash >Kitkat


Recent versions of the renderscriptSupport fixed renderscript back to version 11. I tested these, on proper devices and emulators. But, after production everybody running KitKat or lower crashed.

defaultConfig {
    applicationId "com.photoembroidery.tat.olsennoise"
    minSdkVersion 11
    targetSdkVersion 24
    versionCode 9
    versionName "1.6bRS"

    renderscriptTargetApi 23
    renderscriptSupportModeEnabled true
}

The built script it had was:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Which enabled minify for the releases, and any signed APK crashed. Whereas when I changed to:

buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

The signed APKs stopped crashing on Kitkat devices.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.photoembroidery.tat.olsennoise/com.photoembroidery.tat.olsennoise.OlsenNoise}: android.support.v8.renderscript.m: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.photoembroidery.tat.olsennoise-1/lib/arm/librsjni.so" Support lib API: 2301
Caused by: android.support.v8.renderscript.m: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.photoembroidery.tat.olsennoise-1/lib/arm/librsjni.so" Support lib API: 2301

and:

java.lang.NoSuchMethodError: no static or non-static method "Landroid/support/v8/renderscript/RenderScript;.nDeviceDestroy(J)V"

Is there something else I might be missing? It is the minified right? Is there someway to safely get most of minified working for most of the script (extra meg of bloat isn't awesome)?


Solution

  • The problem persists Dec 2016 but proguard rules work:

    -keep class com.photoembroidery.tat.olsennoise.** {*;}
    -keep class android.support.v8.renderscript.** {*;}
    

    Stopped crashing on KitKat.