Android Studio 3.2升级上的java.lang.VerifyError

时间:2018-09-27 03:20:30

标签: android

我环顾四周,试图清理构建文件夹,使高速缓存无效并重新启动,并设置android.enableR8=false

但是当我构建一个发行版APK并尝试运行该应用程序时,我仍然无法解决这个问题。

2018-09-26 23:07:19.428 19200-19200/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: sic.nzb.app, PID: 19200
    java.lang.VerifyError: Verifier rejected class com.google.firebase.FirebaseApp: void com.google.firebase.FirebaseApp.<clinit>() failed to verify: void com.google.firebase.FirebaseApp.<clinit>(): [0x33] register v1 has type Uninitialized Reference: java.lang.Object Allocation PC: 49 but expected Reference: java.lang.Object
     void com.google.firebase.FirebaseApp.<init>(android.content.Context, java.lang.String, com.google.firebase.FirebaseOptions) failed to verify: void com.google.firebase.FirebaseApp.<init>(android.content.Context, java.lang.String, com.google.firebase.FirebaseOptions): [0x4B] 'this' arg must be initialized (declaration of 'com.google.firebase.FirebaseApp' appears in base.apk)
        at com.google.firebase.FirebaseApp.a(SourceFile:274)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

渐变依赖项:

dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'


implementation project(':oIFileManager')
implementation project(':FullScreenActivity')
implementation rootProject.ext.libraries.appcompatv7
implementation rootProject.ext.libraries.supportdesign
implementation 'org.jsoup:jsoup:1.11.3'
implementation project(path: ':unrar-native')
implementation 'com.google.guava:guava:23.0-android'

implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation 'org.powermock:powermock-module-junit4:1.6.2'
testImplementation 'org.powermock:powermock-api-mockito:1.6.2'
testImplementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'

implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
}

}

2 个答案:

答案 0 :(得分:1)

通过更新proguard-project.txt解决

从:

-assumenosideeffects class android.util.Log {
*;

}

收件人:

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

答案 1 :(得分:0)

这是因为正在引用您较早的Firebase依赖项,并且必须与导致“ VerifyError”的类相关的某些更改。因此,您需要删除主目录下的.gradle文件夹,例如~/.gradle(适用于Linux或macOS),以及项目根目录下的.gradle。另外,也尝试删除主目录.m2下的所有缓存的~/文件夹。