当我使用proguard构建发行版时,在应用程序启动时出现运行时错误(已追溯):
2018-12-18 23:10:37.787 16077-16077/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cantalk.ruen.dialogs, PID: 16077
java.lang.VerifyError: Verifier rejected class age: void com.google.android.gms.common.wrappers.Wrappers.<init>() failed to verify: void com.google.android.gms.common.wrappers.Wrappers.<init>(): [0x1] Constructor returning without calling superclass constructor (declaration of 'com.google.android.gms.common.wrappers.Wrappers' appears in base.apk)
at com.google.android.gms.common.wrappers.Wrappers.packageManager(Unknown Source:0)
at com.google.android.gms.internal.ads.zzze.zzh(Unknown Source:0)
at com.google.android.gms.internal.ads.zzze.attachInfo(Unknown Source:0)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:2)
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)
我认为它是由admob初始化引起的,但我不知道为什么它以前起作用。 依存关系更新后出现此错误:
答案 0 :(得分:0)
就我而言,我在保护规则中使用了assumenosideeffects
。像这样:
-assumenosideeffects class java.io.PrintStream { *; }
这在proguard中引起了一个错误,该错误导致从每个类的构造函数中删除超类构造函数调用。要解决此问题,您必须将其更改为:
-assumenosideeffects class java.io.PrintStream {
*** <fields>;
*** <methods>;
}
PrintStream
是您要使用proguard进行混淆的类。
这样就解决了我的问题。