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

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

    In my case the method that the error message said was 'bad', had some unknown faults. Changing from a Kotlin lambda to a regular loop solved my issue.

    Before (With Error):

    fun validZipCode(zipcode: String): Boolean {
        val validRegexes = arrayOf(
                "0[0-9]{1}[0-9]{2}", 
                "1[0-2]{1}[0-9]{2}", 
                "1[3-4]{1}[0-9]{2}", 
                "19[0-9]{2}", 
                "2[0-1]{1}[0-9]{2}" 
        )
    return validRegexes.any { zipcode.matches(it.toRegex()) }
    

    After:

    fun validZipCode(zipcode: String): Boolean {
    
        val validRegexes = arrayOf(
                "0[0-9]{1}[0-9]{2}", 
                "1[0-2]{1}[0-9]{2}", 
                "1[3-4]{1}[0-9]{2}",
                "19[0-9]{2}", 
                "2[0-1]{1}[0-9]{2}"
        )
    
        for (regex in validRegexes) {
            if (zipcode.matches(regex.toRegex())) {
                return true
            }
        }
    
        return false
    }
    
    0 讨论(0)
  • 2020-12-05 07:11

    Simple (3) steps worked for me:

    1 - from top menu of android studio build --> clean project

    2 - from top menu of android studio build --> make project

    3 - from top menu of android studio build --> rebuild project

    All set up..

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

    Verify Error is majorly thrown in certain scenarios which occurs if we changed definition of class A, but class B was compiled using an older version of the class A. That's why it gets resolved if we clear our project and rebuild all the classes together with same version of Java.

    Following link lists some of the scenarios where Verify error might occur. java.lang.VerifyError – How to solve VerifyError

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

    May be this can help some one who is facing this issue in Debug Build as well.

    I was also facing the same error.I missed to Configure Google API Console project. So Configure Google API Console project following this and specify your app's package name when prompted. You will also need to provide the SHA-1 hash of your signing certificate. See Authenticating Your Client for information.

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