3

signed app gives error!

my app uses an external Admob jar, however proguard is touching the jar:

the jar file is located at /libs/GoogleAdMobAdsSdk-6.2.1.jar

Thank you

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)

which is inside the jar-file

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>;
}

after adding

-keep public class com.google.ads.**

to the file, the eclipse console gives still the following error:

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)
user1616685
  • 1,310
  • 1
  • 15
  • 36

3 Answers3

8

I just added the

-dontwarn com.google.ads.**

to the proguard-project.txt file and the signed apk works fine! this is recommended (like Eric said before) here: Proguard can't find referenced class com.google.ads.internal.state.AdState

Community
  • 1
  • 1
user1616685
  • 1,310
  • 1
  • 15
  • 36
  • that really works for me..I ha also added as per Eric Leichtenschlag Nov 2 at 16:55 comment. Thanks to both of you.. – Lijo John Dec 08 '12 at 17:10
  • This code signed the application but the admob ads did appear and gave classnotfoundexception but @peterdk code worked for me. – Piyush Dec 22 '13 at 12:00
4

This worked for me on It seems that you need to add these 2 items to the proguard config :

-dontwarn com.google.ads.**
-keep class com.google.ads.**  {*;}
Peterdk
  • 15,625
  • 20
  • 101
  • 140
Britc
  • 623
  • 5
  • 8
0

-dontwarn com.google.ads.** here secure the ads class if you want to secure your class then add com.pkgname.**

Ankit Patel
  • 13
  • 1
  • 5