我正在使用Google Play服务v.9.2.1,(模块ads-lite
和basement
)。
Admob测试广告显示正常,但有些警告会写入Logcat:
W/Ads(): Failed to instantiate ClientApi class.
W/Ads(): java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.internal.ClientApi" on path: /data/app/myApp.apk
W/Ads(): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
W/Ads(): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
W/Ads(): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl.zzik(Unknown Source)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl.zzil(Unknown Source)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl.zza(Unknown Source)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl$zza.zziu(Unknown Source)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl.zza(Unknown Source)
W/Ads(): at com.google.android.gms.ads.internal.client.zzl.zzc(Unknown Source)
W/Ads(): at com.google.android.gms.ads.AdActivity.onCreate(Unknown Source)
W/Ads(): at android.app.Activity.performCreate(Activity.java:5283)
W/Ads(): ClientApi class cannot be loaded.
出现这些警告时未使用Proguard。我是否需要包含其他库?
答案 0 :(得分:1)
是。由于您使用的是移动广告,因此需要add Proguard。这可以防止对Google移动广告SDK中公共类的所有公共方法进行模糊处理。
要将ProGuard安全地用于Google移动广告,请将以下内容添加到ProGuard配置中:
-keep public class com.google.android.gms.ads.** {
public *;
}
-keep public class com.google.ads.** {
public *;
}
此thread也可为您提供额外的洞察力。