VerifyError: Verifier rejected class ... 'this' arg must be initialized
Asked Answered
P

6

6

after third-party library upgrade I got a new crash on app launch:

java.lang.VerifyError: Verifier rejected class ly.img.android.e: void ly.img.android.e.<init>(java.lang.String, boolean) failed to verify: void ly.img.android.e.<init>(java.lang.String, boolean): [0x5C] 'this' arg must be initialized (declaration of 'ly.img.android.e' appears in base.apk!classes2.dex)
    at ly.img.android.b.<clinit>(Unknown Source:46)
    at ly.img.android.c.b(Unknown Source:0)
    at ly.img.android.PESDK.initSDK(Unknown Source:0)
    at ly.img.android.IMGLYAutoInit.onCreate(IMGLYAutoInit.java:41)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)

Yes, I know that there are a lot of similar problems there but I didn't find any solution or advise for me.

So, maybe someone there can provide hint or advise for me what's wrong there. Thanks

Pentane answered 5/5, 2020 at 7:44 Comment(0)
P
1

How did I resolve the issue:

I have upgraded gradle version from 3.5.3 to 3.6.3. Ough and thank you. Maybe my experience can help somebody.

Pentane answered 4/6, 2020 at 10:38 Comment(0)
L
4

Others were also facing this kind of issue, I think this can help you! ⛅

java.lang.VerifyError: Verifier rejected class ly.img.android.e: void ly.img.android.e.<init>(java.lang.String, boolean) failed to verify: void ly.img.android.e.<init>(java.lang.String, boolean): [0x5C] 'this' arg must be initialized (declaration of 'ly.img.android.e' appears in base.apk!classes2.dex)

But according to a GitHub thread they found a solution to this problem

https://github.com/CleverTap/clevertap-android-sdk/issues/15#issuecomment-454842450

The fix for this issue is available for AGP(Android Gradle Plugin) 3.3 (and 3.4) by setting an explicit dependency detailed below. After AGP 3.3.1 is released, remove the pinned version to allow you to pick up new D8/R8 releases again.

For AGP 3.3 amend your top-level build.gradle file with:

buildscript {
    repositories {
        maven {
            url "http://storage.googleapis.com/r8-releases/raw" // ADD THIS.
        }
    }
    dependencies {
        classpath 'com.android.tools:r8:1.3.52'  // ADD THIS. Must be before the Gradle Plugin for Android.
        classpath 'com.android.tools.build:gradle:3.3'
    }
}

For AGP 3.4 the r8 version should be 1.4.25

Lynnlynna answered 28/5, 2020 at 17:23 Comment(0)
P
1

How did I resolve the issue:

I have upgraded gradle version from 3.5.3 to 3.6.3. Ough and thank you. Maybe my experience can help somebody.

Pentane answered 4/6, 2020 at 10:38 Comment(0)
G
0

I have a suggestion Maybe it will help

android {

    defaultConfig {
       ...
        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

and

 implementation 'com.android.support:multidex:1.0.0'
Germayne answered 3/6, 2020 at 9:15 Comment(0)
L
0

I think this is the probelm with third-party library.

In my case, I built the library .jar myself and had no idea why the VerifyError would appear when trying to test the .jar in a test application.

The problem was in proguard.cfg with -assumenosideeffects and Log.

Specifically, inside proguard.cfg (of my library) there was a following line:

-assumenosideeffects class android.util.Log {*;}

Replacing it with:

-assumenosideeffects class android.util.Log {
    public static *** v(...);
    public static *** d(...);
    public static *** i(...);
    public static *** w(...);
    public static *** e(...);
}

and building and obfuscating it again resolved the problem.

I found the answer to my problem here.

I know this doesn't directly answer to the original question, but I left this answer here in order to help someone who is trying to build the .jar and the result of using it is VerifyError.

Lachus answered 30/6, 2021 at 8:58 Comment(0)
C
0

I had a similar error:

FATAL EXCEPTION: Connection#7864356
    Process: ..., PID: 24458
    java.lang.VerifyError: Verifier rejected class r8.a: r8.b r8.a.b(w8.a[]) failed to verify: r8.b r8.a.b(w8.a[]): [0x33] expected to be within a catch-all for an instruction where a monitor is held (declaration of 'r8.a' appears in /data/app/~~DIy9qxh1lGM...==/base.apk)
        at p7.g$b.b(SourceFile:270)
        at p7.g$b.run(SourceFile:35)

This happened after I updated gradle from 4.2.2 to 7.3.1. I tried disabling obfuscation and the @Keep option for the specified classes in the error message. But nothing helped. In debug mode, everything still worked, but in the release the app crashed with an error.

Thanks Dupinder Singh. I've changed my top-level build.gradle file with:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools:r8:4.0.48'
        classpath 'com.android.tools.build:gradle:7.3.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Now everything works. Maybe my solution will help someone.

Catanzaro answered 19/1, 2023 at 15:44 Comment(0)
D
0

I have added api call inside the coroutineScope this way error was resolved.

import kotlinx.coroutines.coroutineScope

coroutineScope {
  //Your Api Call
}
Deannedeans answered 18/7 at 7:56 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Punctate

© 2022 - 2024 — McMap. All rights reserved.