我使用 proguard,在 proguard-project.txt 中,我有忽略引用类的行
-dontwarn com.google.ads.**
日志说:
Warning: com.flurry.android.ab: can't find referenced class com.google.ads.InterstitialAd Warning: com.flurry.android.ab: can't find referenced class com.google.ads.InterstitialAd Warning: com.flurry.android.ab: can't find referenced class com.google.ads.InterstitialAd Warning: com.flurry.android.ab: can't find referenced class com.google.ads.AdRequest Warning: com.flurry.android.ab: can't find referenced class com.google.ads.AdRequest
..........
You should check if you need to specify additional program jars. Warning: there were 277 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)
我将 -libraryjars ./libs/FlurryAgent.jar 行包含到配置文件中。我的问题是什么?
最佳答案
如您所试,您应该将这一行放在 proguard-project.txt
中:
-dontwarn com.google.ads.**
您必须确保 ProGuard 确实在使用此配置文件,在 project.properties
中使用此行:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
这是 Android SDK r20 或更高版本的标准行(旧版本仅使用 proguard.config=proguard.cfg
,在这种情况下,您必须指定整个配置,而不是依赖一个在 SDK 中)。
关于android - Proguard 不会忽略引用的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15568927/