已签名的应用提供错误!
我的应用程序使用外部Admob jar,但是proguard正在触摸jar:
jar文件位于/libs/GoogleAdMobAdsSdk-6.2.1.jar
谢谢
LogCat错误:
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)
位于jar文件
中Config proguard-project.txt:
-libraryjars /libs/GoogleAdMobAdsSdk-6.2.1.jar
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
添加后
-keep public class com.google.ads.**
到文件,eclipse控制台仍然出现以下错误:
Proguard returned with error code 1. See console
Note: there were 160 duplicate class definitions.
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)
答案 0 :(得分:8)
我刚刚添加了
-dontwarn com.google.ads.**
到proguard-project.txt文件和签名的apk工作正常! 这是推荐的(如之前Eric所说):Proguard can't find referenced class com.google.ads.internal.state.AdState
答案 1 :(得分:4)
这对我有用。似乎你需要将这两个项目添加到proguard配置中:
-dontwarn com.google.ads.**
-keep class com.google.ads.** {*;}
答案 2 :(得分:0)
-dontwarn com.google.ads。** 这里保护广告类 如果你想保护你的课程,那就加上com.pkgname。**