其實這是好久以前的問題了,但 AdMob SDK 改版多次也沒有改善,所以還是記錄一下以供備忘。
當你的 App 使用 AdMob SDK 6.2.0 或之後的版本,在 Expore Signed APK 時 ProGuard 可能會出現以下的錯誤(內容可能依 AdMob SDK 版本而異):
Proguard returned with error code 1. See console Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState You should check if you need to specify additional program jars. Warning: there were 2 unresolved references to classes or interfaces. You may need to specify additional library jars (using '-libraryjars'). java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:321) at proguard.ProGuard.initialize(ProGuard.java:211) at proguard.ProGuard.execute(ProGuard.java:86) at proguard.ProGuard.main(ProGuard.java:492)
一開始試著在 proguard-project.txt 裡加上 -keep class com.google.ads.** {*;},但沒有效果。之後上 Google Groups 詢問才有位 Googler 回說可以忽略這些 Warning,因此只要在 proguard-project.txt 裡再加上下面這行就行了。
相關連結:
https://groups.google.com/forum/?fromgroups#!topic/google-admob-ads-sdk/JllLSIXWtBk
當你的 App 使用 AdMob SDK 6.2.0 或之後的版本,在 Expore Signed APK 時 ProGuard 可能會出現以下的錯誤(內容可能依 AdMob SDK 版本而異):
Proguard returned with error code 1. See console Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState You should check if you need to specify additional program jars. Warning: there were 2 unresolved references to classes or interfaces. You may need to specify additional library jars (using '-libraryjars'). java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:321) at proguard.ProGuard.initialize(ProGuard.java:211) at proguard.ProGuard.execute(ProGuard.java:86) at proguard.ProGuard.main(ProGuard.java:492)
一開始試著在 proguard-project.txt 裡加上 -keep class com.google.ads.** {*;},但沒有效果。之後上 Google Groups 詢問才有位 Googler 回說可以忽略這些 Warning,因此只要在 proguard-project.txt 裡再加上下面這行就行了。
-dontwarn com.google.ads.**
相關連結:
https://groups.google.com/forum/?fromgroups#!topic/google-admob-ads-sdk/JllLSIXWtBk
留言
張貼留言