Reputation: 1163
I just started using proguard, and used a file found on this site as my proguard.cfg file:
-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 ; }
-keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); }
-keepclasseswithmembers class * { public (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 *; }
when I get to the final step of a signed apk export using eclipse, I get the error:
Proguard returned with error code 1. See console
The console states this:
Proguard returned with error code 1. See console [2012-12-27 14:23:16 - FlashActivity] java.io.FileNotFoundException: C:\Users\Liam\workspace\FlashActivity\bin\proguard.txt (The system cannot find the file specified) [2012-12-27 14:23:16 - FlashActivity] at java.io.FileInputStream.open(Native Method) [2012-12-27 14:23:16 - FlashActivity] at java.io.FileInputStream.(Unknown Source) [2012-12-27 14:23:16 - FlashActivity] at java.io.FileReader.(Unknown Source) [2012-12-27 14:23:16 - FlashActivity] at proguard.FileWordReader.(FileWordReader.java:39) [2012-12-27 14:23:16 - FlashActivity] at proguard.ConfigurationParser.parseIncludeArgument(ConfigurationParser.java:217) [2012-12-27 14:23:16 - FlashActivity] at proguard.ConfigurationParser.parse(ConfigurationParser.java:124) [2012-12-27 14:23:16 - FlashActivity] at proguard.ProGuard.main(ProGuard.java:484)
Judging by the output, I would say that there is supposed to be a proguard.txt
file in my apps bin
folder, and there isn't one.
What should this file contain if I make it?
Upvotes: 1
Views: 3239
Reputation: 3409
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
Make sure minifyEnabled is false
Upvotes: 0
Reputation: 6792
This issue also comes when eclipse is not able to read the progaurd file from the sdk directory.
For me the error came for the dump.txt file, even when it was present in my project.
I fixed this by changing the sdk path in the project.properties file
from
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
to
progaurd.config=D:\Backup\Desktops\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools\proguard\proguard-android.txt:proguard-project.txt
where my sdk was located.
Upvotes: 0
Reputation: 45648
You should update your Android SDK with the interactive android
tool and then also update your project with
android update project --path MyProjectDirectory
This should create proguard-project.txt
and update project.properties
to point to this file.
Upvotes: 2
Reputation: 3322
since adt 17, proguard config file is not proguard.cfg but proguard-project.txt
see http://tools.android.com/recent/proguardimprovements
Upvotes: 3