Android项目:导出问题启动取消! Proguard返回错误代码1.请参阅控制台

前端之家收集整理的这篇文章主要介绍了Android项目:导出问题启动取消! Proguard返回错误代码1.请参阅控制台前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在project.prperties中没有评论下面的行
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

工作准备工作正常工作.

但是当我添加了android-support-v4.jar库时,在导出签名的应用程序项目时出错

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)

我试图添加以下行proguard-project.txt,但它不工作

-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.** {*;}

@R_502_323@

我自己找到答案
在proguard-project.txt文件添加以下2行解决了问题.
-dontwarn com.google.android.gms.*
-ignorewarnings
原文链接:https://www.f2er.com/android/311030.html

猜你在找的Android相关文章