java.lang.VerifyError: Verifier rejected class on Lollipop when using release APK

前端 未结 10 2076
渐次进展
渐次进展 2020-12-05 06:22

I get this error when I install my release APK on a 5.x device. The error does not occur when I push the same code from Android Studio, or if I run it on a

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 07:00

    My app was working on most platforms but crashing immediately on Android 5.1. I started to suspect the new D8 dex compiler after reading Google info on how great it is. Disabling D8, so it uses the original DX compiler, is the only thing that worked for me. Project clean/invalidate caches didn't fix it. I had some synchronized blocks, but removing them didn't fix it. Turning off instant run didn't fix it. Disabling proguard didn't fix it.

    Here is how you disable D8:
    -Create a file called gradle.properties in the root of your project, if it doesn't exist
    -In it put this line: android.enableD8=false

    You'll get deprecated warnings. Hopefully Google actually fixes D8 before they fully remove the deprecated DX. I don't know what in my code triggers it. I'm using Android Studio 3.2.1 with gradle version 4.6. Edit: I've reported this bug and Google developers are actively investigating

提交回复
热议问题