Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android project: Export problem Launch canceled! Proguard returned with error code 1. See console

I un-commented below line in project.prperties

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

to work progard and it was working fine.

But when I added android-support-v4.jar library, got error while Exporting signed application project

Launch canceled!
 Proguard returned with error code 1. See console
 Note: there were 316 duplicate class definitions.
 Warning: com.google.android.gms.common.images.ImageManager$a: can't find superclass or interface android.content.ComponentCallbacks2
 Warning: com.google.android.gms.maps.MapFragment: can't find superclass or interface android.app.Fragment
 Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced field 'int smallestScreenWidthDp' in class android.content.res.Configuration
 Warning: com.google.android.gms.common.images.ImageManager: can't find referenced method 'void registerComponentCallbacks(android.content.ComponentCallbacks)' in class android.content.Context
 Warning: com.google.android.gms.common.images.ImageManager$a: can't find referenced class android.content.ComponentCallbacks2
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$a: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$a: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$b: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$b: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$b: can't find referenced class android.app.Fragment
 Warning: com.google.android.gms.maps.MapFragment$b: can't find referenced class android.app.Fragment
   You should check if you need to specify additional program jars.
 Warning: there were 21 unresolved references to classes or interfaces.
      You may need to specify additional library jars (using '-libraryjars').
 Warning: there were 2 unresolved references to program class members.
      Your input classes appear to be inconsistent.
      You may need to recompile them and try again.
      Alternatively, you may have to specify the option 
          '-dontskipnonpubliclibraryclassmembers'.
 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)

I tried adding below lines to proguard-project.txt but its not working

-dontwarn android.support.**
-dontwarn com.google.ads.**
-libraryjars libs/android-support-v4.jar
-keep public class * extends com.phonegap.api.Plugin 
-keep public class org.apache.cordova.DroidGap 
-keep public class org.apache.cordova.** 
-dontwarn android.webkit.*
-dontwarn org.apache.**
-dontwarn  android.support.v7.widget.**
-keep class android.support.v7.widget.** { *; }
-dontwarn com.google.ads.** -keep class com.google.ads.** {*;}
-keep class com.google.android.gms.analytics.**
-keep class com.google.analytics.tracking.**
-dontwarn com.google.android.gms.analytics.**
-dontwarn com.google.analytics.tracking.**
-keep class com.google.ads.**  { *; }
-dontwarn com.google.ads.**
-keep public class com.admob.android.ads.** {*;}
like image 470
android developer Avatar asked Apr 05 '13 13:04

android developer


1 Answers

I found the answer myself. Adding below 2 lines in proguard-project.txt file solved the problem.

-dontwarn com.google.android.gms.*
-ignorewarnings 
like image 127
android developer Avatar answered Oct 05 '22 16:10

android developer