[Android]添加第三方jar後,使用ProGuard混淆打包出錯的解決方法

在我的android應用中,加入了google廣告推廣的第三方庫admob jar,但是在通過ProGuard混淆打包的時候找不到相關引用的類com.google.ads.internal.state.AdState 

jar文件的位置是在 /libs/GoogleAdMobAdsSdk-6.2.1.jar

 

LogCat error:

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)

  只需要添加下面一句代碼

-dontwarn com.google.ads.**

到proguard-project.txt文件中,就可以成功的生成簽名apk了! 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章