导出APK使用proguard返回错误

时间:2015-04-11 08:26:14

标签: android proguard

我有一个项目,并希望进行预测以获得更高的安全性。 但是在导出时会返回以下错误:

返回

proguard,错误代码为1,请参阅控制台

     [2015-05-18 11:55:49 - sd] Proguard returned with error code 1. See console
     [2015-05-18 11:55:49 - sd] Note: there were 4 duplicate class definitions.
     [2015-05-18 11:55:49 - sd] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer
     [2015-05-18 11:55:49 - sd] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.content.res.ColorStateList depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
     [2015-05-18 11:55:49 - sd]       You should check if you need to specify additional program jars.
     [2015-05-18 11:55:49 - sd] Warning: there were 10 instances of library classes depending on program classes.
     [2015-05-18 11:55:49 - sd]          You must avoid such dependencies, since the program classes will
     [2015-05-18 11:55:49 - sd]          be processed, while the library classes will remain unchanged.
     [2015-05-18 11:55:49 - sd] Error: Please correct the above warnings first.

项目proterties

  # This file is automatically generated by Android Tools.
  # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  #
  # This file must be checked in Version Control Systems.
  #
  # To customize properties used by the Ant build system edit
  # "ant.properties", and override values to adapt the script to your
  # project structure.
  #
  # To enable ProGuard to shrink and obfuscate your code, uncomment this       (available properties: sdk.dir, user.home):
  #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

  # Project target.
  target=android-19
  proguard.config=proguard.cfg

proguard.cfg

  -optimizationpasses 5
  -dontusemixedcaseclassnames
  -dontskipnonpubliclibraryclasses
  -dontpreverify
  -verbose
  -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

  -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.app.backup.BackupAgentHelper
  -keep public class * extends android.preference.Preference
  -keep public class com.android.vending.licensing.ILicensingService

  -keepclasseswithmembernames class * {
      native <methods>;
  }

  -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.app.Activity {
     public void *(android.view.View);
  }

  -keepclassmembers enum * {
      public static **[] values();
      public static ** valueOf(java.lang.String);
  }

  -keep class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
  }

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

在proguard.cfg中使用-dontwarn删除警告

-dontwarn  org.xmlpull.v1.**