简体   繁体   English

Proguard - 找不到[com / google / android / gms / d / kl]的常见超类

[英]Proguard - Can't find common super class of [com/google/android/gms/d/kl]

I am failing to create a release build. 我无法创建发布版本。 Suddenly Android Studio started throwing below error. 突然,Android Studio开始抛出以下错误。

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)

Here is my Proguard Configurations 这是我的Proguard配置

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

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

Here is the list of gradle dependencies of my project 这是我的项目的gradle依赖项列表

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
    }
}

Note Commenting the Facebook audience network dependency fixes the error. 注意注释Facebook受众网络依赖关系可修复错误。 Unfortunately I cannot do it permanently from the project. 不幸的是,我不能永久地从项目中做到这一点。

Please help me identifying the cause of an issue. 请帮我确定问题的原因。 Thanks in advance. 提前致谢。

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. 由于我不是Proguard专家,我可能错了,但这是我目前看到的解决方法。

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. 正如我在问题中提到的,Facebook Audience Network导致发布版本的问题,并且错误与GMS Play Service库相关联。 According to comment posted by @pedrofsn, Facebook Audience Network uses the Google Play Service Ads library. 根据评论发表@pedrofsn,Facebook的受众网络使用谷歌Play业务信息库。

I started looking into documentation for the error Can't find common super class of . 我开始研究错误的文档 Can't find common super class of It says that 它说

A class in one of your program jars or library jars is referring to a class or interface that is missing from the input. 其中一个程序jar或库jar中的类指的是输入中缺少的类或接口。 The warning lists both the referencing class(es) and the missing referenced class(es). 警告列出了引用类和缺少的引用类。 There can be a few reasons, with their own solutions: 可以有几个原因,有自己的解决方案:

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 正如它所说的警告列出了引用类和缺少的引用类(es),我决定删除dontwarn只是为了看到Proguard的警告并更新我的Proguard配置如下

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

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

I managed to see all the warnings by Proguard as the screenshot below. 我设法看到Proguard的所有警告,如下面的截图。

在此输入图像描述

As we can see from the screenshot, google ads library classes cannot find their referenced class com.google.android.gms.common.internal.zzac . 正如我们从屏幕截图中看到的那样,谷歌广告库类无法找到他们引用的类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. 我的猜测是这个类com.google.android.gms.common.internal.zzac应该属于谷歌广告依赖的内部jar并且可能缺少内部jar。

So I have manually added the google ads dependency to my app level build.gradle as below 因此,我已手动将Google广告相关性添加到我的应用级build.gradle ,如下所示

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

And I see I can compile the release build successfully. 我看到我可以成功编译发布版本。

我将'com.google.firebase:firebase-messaging:17.0.0'降级为'com.google.firebase:firebase-messaging:15.0.2'

For this to work, I had to uncomment: 要做到这一点,我必须取消注释:

buildTypes {
    release {
        //minifyEnabled true
        //shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

and add the below to your proguard-rules.pro file: 并将以下内容添加到您的proguard-rules.pro文件中:

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

although uncommenting minifyEnabled is not recommended since it removes dead/unused code 虽然不建议取消注释minifyEnabled因为它会删除死/未使用的代码

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到[com / google / android / gms / internal / zzol]的普通超类 - Can't find common super class of [com/google/android/gms/internal/zzol] ProGuard:找不到引用的类com.google.android.gms.R - ProGuard: can't find referenced class com.google.android.gms.R Proguard错误:“无法找到…的普通超类” - Proguard error: “Can't find common super class of …” 没有找到类“com.google.android.gms.common.internal.zzaa” - Didn't find class “com.google.android.gms.common.internal.zzaa” 在路径上没有找到类“com.google.android.gms.common.internal.zzbq”:DexPathList - Didn't find class “com.google.android.gms.common.internal.zzbq” on path: DexPathList 找不到类“ com.google.android.gms.common.util.zzs” - Didn't find class “com.google.android.gms.common.util.zzs” 没找到上课“com.google.android.gms.common.app.GmsApplication” - Didn't find class “com.google.android.gms.common.app.GmsApplication” ClassNotFoundException找不到类“ com.google.android.gms.common.internal.zzbq - ClassNotFoundException Didn't find class "com.google.android.gms.common.internal.zzbq 放置自动完成未找到类“ com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” - Places AutoComplete Didn't find class “com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” com.google.android.gms.internal.zzhu:找不到引用的类android.security.NetworkSecurityPolicy - com.google.android.gms.internal.zzhu: can't find referenced class android.security.NetworkSecurityPolicy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM