Proguard-找不到[com/google/android/gms/d/kl]的普通超类 [英] Proguard - Can't find common super class of [com/google/android/gms/d/kl]

查看:120
本文介绍了Proguard-找不到[com/google/android/gms/d/kl]的普通超类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法创建发行版本.突然,Android Studio开始抛出以下错误.

I am failing to create a release build. Suddenly Android Studio started throwing below error.

Unexpected error while performing partial evaluation:
  Class       = [com/google/android/gms/d/lc]
  Method      = [a(Lcom/google/android/gms/d/kk;Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/google/android/gms/d/lh;Lcom/google/android/gms/d/en;Lcom/google/android/gms/d/lb;)Lcom/google/android/gms/d/kn;]
  Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/d/kn] (with 1 known super classes) and [java/lang/String] (with 2 known super classes))
Unexpected error while preverifying:
  Class       = [com/google/android/gms/d/lc]
  Method      = [a(Lcom/google/android/gms/d/kk;Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/google/android/gms/d/lh;Lcom/google/android/gms/d/en;Lcom/google/android/gms/d/lb;)Lcom/google/android/gms/d/kn;]
  Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/d/kn] (with 1 known super classes) and [java/lang/String] (with 2 known super classes))
Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Can't find common super class of [com/google/android/gms/d/kn] (with 1 known super classes) and [java/lang/String] (with 2 known super classes)

这是我的Proguard配置

Here is my Proguard Configurations

-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**

-keep class com.facebook.ads.** { *; }

这是我的项目的gradle依赖项列表

Here is the list of gradle dependencies of my project

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-config:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.0'
    implementation 'com.google.android.gms:play-services-drive:15.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.startapp:inapp-sdk:3.8.4'
    implementation 'com.facebook.android:audience-network-sdk:4.28.2'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.7.1'
    testImplementation 'org.powermock:powermock-mockito-release-full:1.4.9'   
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
}

注意:评论Facebook受众网络依赖性可修复该错误.不幸的是,我不能从项目中永久地做到这一点.

Note Commenting the Facebook audience network dependency fixes the error. Unfortunately I cannot do it permanently from the project.

请帮助我确定问题的原因.预先感谢.

Please help me identifying the cause of an issue. Thanks in advance.

推荐答案

最后,我设法解决了该错误.因为我不是Proguard专家,所以我可能是错的,但这是我目前看到的解决方法.

Finally I managed to fix the error. As I am not Proguard expert, I may be wrong but this is the workaround I see at the moment.

正如我在问题中提到的,Facebook Audience Network导致发行版本出现问题,并且错误与GMS Play服务库相关.根据@pedrofsn发表的评论, Facebook Audience Network使用Google Play服务广告库.

As I have mentioned in the question, Facebook Audience Network causes the problem with the release build and errors are associated with the GMS Play Service library. According to comment posted by @pedrofsn, Facebook Audience Network uses the Google Play Service Ads library.

我开始查看文档,以查找错误Can't find common super class of .它说

I started looking into documentation for the error Can't find common super class of. It says that

您的一个程序jar或库jar中的类是指一个 输入中缺少的类或接口.警告清单 引用类和缺少的引用类. 可能有一些原因,以及他们自己的解决方案:

A class in one of your program jars or library jars is referring to a class or interface that is missing from the input. The warning lists both the referencing class(es) and the missing referenced class(es). There can be a few reasons, with their own solutions:

警告说它同时列出了引用类和缺少的引用类,所以我决定删除dontwarn只是为了看Proguard& amp;的警告.如下更新了我的Proguard配置

As it says the warning lists both the referencing class(es) and the missing referenced class(es), I decided to remove dontwarn just to see the warnings by the Proguard & updated my Proguard Configuration as below

-keep public class com.google.android.gms.* { public *; }

-keep class com.facebook.ads.** { *; }

我设法在下面的屏幕截图中看到了Proguard的所有警告.

I managed to see all the warnings by Proguard as the screenshot below.

从屏幕截图中可以看到,google ads库类找不到其引用的类com.google.android.gms.common.internal.zzac.我的猜测是,此类com.google.android.gms.common.internal.zzac应该属于google ads依赖性&的内部jar.该内部jar可能丢失.

As we can see from the screenshot, google ads library classes cannot find their referenced class com.google.android.gms.common.internal.zzac. My guess is that this class com.google.android.gms.common.internal.zzac should belong to the internal jar of the google ads dependency & that internal jar is probably missing.

因此,我已将google ads依赖项手动添加到我的应用级别build.gradle,如下所示

So I have manually added the google ads dependency to my app level build.gradle as below

implementation 'com.google.android.gms:play-services-ads:15.0.1' 

我看到我可以成功编译发行版本.

And I see I can compile the release build successfully.

这篇关于Proguard-找不到[com/google/android/gms/d/kl]的普通超类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆