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

前端 未结 10 1960
渐次进展
渐次进展 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 06:55

    I had the same issue thrown by GoogleTagManager.

    java.lang.VerifyError: Verifier rejected class com.google.android.gms.tagmanager.TagManager: com.google.android.gms.common.api.PendingResult com.google.android.gms.tagmanager.TagManager.loadContainerDefaultOnly(java.lang.String, int) failed to verify: com.google.android.gms.common.api.PendingResult com.google.android.gms.tagmanager.TagManager.loadContainerDefaultOnly(java.lang.String, int): [0x11] returning 'Reference: com.google.android.gms.tagmanager.zzp', but expected from declaration 'Reference: com.google.android.gms.common.api.PendingResult'

    It happened after the merge. My collegue updated the library from 10.0.1 to 10.2.1. Clean build didn't work.

    Due to time constraints, i rollback to the older version, and it worked.

    0 讨论(0)
  • 2020-12-05 06:57

    In my case, the cause is proguard. My app shutdown on sumsung note3 whick is android 5.0.
    I imported the android-async-http-1.4.9.jar, the proguard is:

    -dontwarn com.loopj.android.http.**
    -keep class com.loopj.android.http.**{*;}
    

    It is not enough. I added:

    -dontwarn cz.msebera.**
    -keep class cz.msebera.**{*;}
    

    the bug gone.

    so if you come into this bug, the deep-seated reason maybe not obvious, it is to be noted the proguard file.

    0 讨论(0)
  • 2020-12-05 07:00

    Cleaning out the build folder resolved the problem. Not sure why ART had an issue but Dalvik did not.

    Running a gradle clean task was not clearing out my build folder all the way. I had to do it manually, but clean may work for some people.

    0 讨论(0)
  • 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

    0 讨论(0)
  • 2020-12-05 07:04

    In my case, I simply disabled the "Instant Run" option from my "Build, Execution, Deployment" settings. Unfortunately the Android studio feature "Instant Run" is still far from being stable...

    To do so:

    1. go to "File" > "Settings" > "Build, Execution, Deployment" > "Instant Run"
    2. uncheck the box "Enable Instant Run..." and click "OK" button
    0 讨论(0)
  • 2020-12-05 07:06

    In my case, the cause was slightly different.

    Apparently, putting a synchronized statement inside a try/catch block causes the VerifyError, as reported here on SO and on the official bug tracker.

    0 讨论(0)
提交回复
热议问题