Android - proguard.cfg error

﹥>﹥吖頭↗ 提交于 2019-12-06 15:38:06

This is a sample config file that I use with proguard 4.4, JDK 1.6, target android 2.1. Check your proguard version by double clicking on the jar file or with java -jar android-sdk/tools/proguard/lib/proguard.jar (use android sdk install path)

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

It seems to be an Eclipse / Android SDK error i suggest

1) close the project is giving error to you 2) remove it from eclipse ( do not remove folder or source ) 3) import the project you removed 4) clean and build again

Best regards stefano

Vitaliy A

if Previous answer didnt help

Then just create empty Android project in Eclipse and copy/replace created "proguard.cfg" file to your project.

This is what helped me; Right click on project's name, and click on "Android Project". Then select "Clear Lint Markers". Seems that I had accidentally run "Lint" for checking for some common problems after which I began seeing those proguard.cfg errors. Funny thing is that even though I was compiling in debug mode, eclipse would still complain about proguard (which is supposed to be used when compiling in release mode only).

proguard.cfg will be in your project's root. edit it, replacing:

-keepclasseswithmembernames class * {

with

-keepclasseswithmembers class * {

worked for me running ADT bundle (v21.0.0-531062 with eclipse 3.7.2 using JDK1.7 under windowsxp).

selected the error in eclipse problems window. and it works for me.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!