启用Proguard后“强制关闭应用程序”

时间:2014-11-27 07:42:37

标签: android proguard

这是一个有Proguard的工作应用程序 但现在,我使用Android-Tools > Export signed application启用了 Proguard并导出已签名的应用

然后我将此.apk复制到SD卡上并尝试在设备上安装。但是应用程序停止了工作

我的Proguard.cfg code

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose


-dontoptimize
-dontpreverify


-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.app.backup.BackupAgent
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment

-keepclasseswithmembernames class * {
    native <methods>;
}

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

-keepclassmembers class **.R$* {
    public static <fields>;
}


-dontwarn android.support.**
-dontwarn org.acra.**
-dontwarn com.google.**
-dontwarn com.jeremyfeinstein.**

我正在使用滑动菜单和google analyic and acra crash report。非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

我用以下鳕鱼解决了我的问题: 我将鳕鱼添加到文件Proguard.cfg:

-dontwarn org.acra.**
-keep class org.acra.** { *; }
-dontwarn com.google.**
-keep class com.google.analytics.tracking.android.** { *; }
-dontwarn com.jeremyfeinstein.**
-keep class com.jeremyfeinstein.slidingmenu.lib.** { *; }