生成APK时pro-guard配置错误

pro-guard configuration error while generating APK

应用 pro-guard 时出现此错误

Unexpected error while performing partial evaluation:
  Class       = [com/google/android/gms/ads/AdLoader$Builder]
  Method      = [forPublisherAdView(Lcom/google/android/gms/ads/formats/OnPublisherAdViewLoadedListener;[Lcom/google/android/gms/ads/AdSize;)Lcom/google/android/gms/ads/AdLoader$Builder;]
  Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/internal/zzko] (with 1 known super classes) and [android/os/RemoteException] (with 5 known super classes))
Unexpected error while preverifying:
  Class       = [com/google/android/gms/ads/AdLoader$Builder]
  Method      = [forPublisherAdView(Lcom/google/android/gms/ads/formats/OnPublisherAdViewLoadedListener;[Lcom/google/android/gms/ads/AdSize;)Lcom/google/android/gms/ads/AdLoader$Builder;]
  Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/google/android/gms/internal/zzko] (with 1 known super classes) and [android/os/RemoteException] (with 5 known super classes))

正在生成签名的 apk。我已经检查了一些问题和答案,但确实有帮助。

proguard-rules.pro

-ignorewarnings

-keep class * {
    public private *;
}

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

带有includedescriptorclasses的配置规则应该保留它:

-keep,includedescriptorclasses class com.google.android.gms.** { *; }
-keep,includedescriptorclasses class com.google.android.gms.internal.** { *; }
-keep,includedescriptorclasses class com.google.android.gms.ads.** { *; }

虽然保留 private 方法打败了混淆的想法:

-keep class * {public private *;}

我找到了解决方案。

应用 pro-guard 后,它没有向我显示确切的错误,但经过更多努力后它显示实际错误,如果删除 pro-guard 则没有错误。

这个错误是由于缺少一些资源,因为我猜它是在构建过程中从缓存中获取的。