使用ProGuard时,我遇到了这个常见的异常。但是,我无法找到解决这个问题的方法。
当代码通过ProGuard运行时,我在运行时遇到此异常:
Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzbyb>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
at boolean com.google.android.gms.internal.zzgr.a(android.content.Context) ((null):-1)
at void com.google.android.gms.internal.zzni$zza.d(android.content.Context) ((null):-1)
at void com.google.android.gms.internal.zzni$zza.<init>(android.content.Context, com.google.android.gms.internal.zzni) ((null):-1)
at com.google.android.gms.internal.zzni com.google.android.gms.internal.zznj$1.a() ((null):-1)
at java.lang.Object com.google.android.gms.internal.zznj$1.call() ((null):-1)
at void com.google.android.gms.internal.zzpn$3.run() ((null):-1)
at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
at void java.lang.Thread.run() (Thread.java:761)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/me.manabreak.bandit.free-1/base.apk"],nativeLibraryDirectories=[/data/app/me.manabreak.bandit.free-1/lib/x86_64, /system/lib64, /vendor/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at boolean com.google.android.gms.internal.zzgr.a(android.content.Context) ((null):-1)
at void com.google.android.gms.internal.zzni$zza.d(android.content.Context) ((null):-1)
at void com.google.android.gms.internal.zzni$zza.<init>(android.content.Context, com.google.android.gms.internal.zzni) ((null):-1)
at com.google.android.gms.internal.zzni com.google.android.gms.internal.zznj$1.a() ((null):-1)
at java.lang.Object com.google.android.gms.internal.zznj$1.call() ((null):-1)
at void com.google.android.gms.internal.zzpn$3.run() ((null):-1)
at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
at void java.lang.Thread.run() (Thread.java:761)
我尝试将这些行添加到我的ProGuard文件中:
-keep class android.support.customtabs.CustomServiceConnection {*; }
-keep class android.support.customtabs.** { *; }
-keepclassmembers class android.support.customtabs.** {*; }
但它没有帮助。我该如何解决这个问题?
答案 0 :(得分:0)
检查您的项目中是否包含Google Design支持库。您可以像这样将其包含在您的应用级Gradle文件中-
implementation 'com.android.support:customtabs:28.0.0'