3

签名的应用程序给出错误!

我的应用程序使用外部 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文件里面

配置 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)
4

3 回答 3

8

我刚刚添加了

-dontwarn com.google.ads.**

到 proguard-project.txt 文件,签名的 apk 工作正常!这里推荐(就像 Eric 之前说的):Proguard can't find referenced class com.google.ads.internal.state.AdState

于 2012-11-19T16:41:36.350 回答
4

这对我有用 看来您需要将这两项添加到 proguard 配置中:

-dontwarn com.google.ads.**
-keep class com.google.ads.**  {*;}
于 2013-03-11T04:06:33.287 回答
0

-dontwarn com.google.ads.** 如果您想保护您的课程,请在此处保护广告课程,然后添加 com.pkgname。**

于 2013-10-11T08:16:07.610 回答