VerifyError: Verifier rejected class com.google.firebase.FirebaseApp using Gradle Plugin 3.2.0 + Proguard to strip logs
Asked Answered
E

1

1

In our project we have been using successfully:

  • Firebase (for FCM)
  • Crashlytics (for reporting crashes)
  • Proguard (optimized version)

All was going fine until last week, when we upgraded to gradle plugin 3.2.0.

In this version, if we have the following proguard configuration to remove calls to Log:

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

when running the app, we get:

java.lang.VerifyError: Verifier rejected class com.google.firebase.FirebaseApp: void com.google.firebase.FirebaseApp.() failed to verify: void com.google.firebase.FirebaseApp.(): [0x37] register v0 has type Uninitialized Reference: java.lang.Object Allocation PC: 53 but expected Reference: java.lang.Object void com.google.firebase.FirebaseApp.(android.content.Context, java.lang.String, com.google.firebase.b) failed to verify: void com.google.firebase.FirebaseApp.(android.content.Context, java.lang.String, com.google.firebase.b): [0x3C] register v8 has type Uninitialized Reference: com.google.firebase.internal.a Allocation PC: 58 but expected Reference: com.google.firebase.FirebaseApp$a com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.a(android.content.Context, com.google.firebase.b, java.lang.String) failed to verify: com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.a(android.content.Context, com.google.firebase.b, java.lang.String): [0x17] register v1 has type Uninitialized Reference: com.google.firebase.FirebaseApp$1 Allocation PC: 21 but expected Reference: com.google.android.gms.common.api.internal.a$a (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.app-2/base.apk)`

If we remove that config to strip the calls to Log all is fine, as it was in the previous version of the gradle plugin (3.1.4).

Does anyone have an idea on what might be causing this?

Earthlight answered 1/10, 2018 at 12:2 Comment(2)
The same problem here and it happens in different places everytime. This grade plugin version is not stable at all... The problem occurs if I use proguard optimized rules, but not if simple rules. Revert back to version 3.1.4 for nowHeyduck
@Heyduck Check the solution provided by Aybareon, it worked for meEarthlight
L
8

Seems like there is some problem with proguard -assumenosideeffects and Log.

Try using -assumenosideffects only on the methods you use and whichever methods that depend on those Log methods.

Something like:

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

instead of the usual

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

Hope this helps.

Lytle answered 2/10, 2018 at 12:23 Comment(2)
It's not working for me. I already have the rules that mentioned above.Heyduck
Ok, found the problem. The problem was in the other assumenosideeffects rules, particularly in *** <init>(...); rule. After removing this line everything is working.Heyduck

© 2022 - 2024 — McMap. All rights reserved.