Kar*_*ela 2 android annotations proguard android-annotations
有人知道如何在Android Annotations中使用Proguard吗?
我找到了这个资源:https: //code.google.com/p/androidannotations/wiki/ProGuard
但是当我从那里使用proguard.cfg文件时,我收到以下错误:
proguard.ParseException: Unknown option '*' in line 6 of file
'/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/proguard.cfg'
Run Code Online (Sandbox Code Playgroud)
这是我从链接中复制的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>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
Run Code Online (Sandbox Code Playgroud)
当您从网站复制并粘贴时,您可能会注意到您的粘贴包含原始星号中没有的星号之前的空格(次要格式错误)..只需删除这两个空格,更改以下行:
-optimizations !code/simplification/arithmetic,!field/ *,!class/merging/ *
Run Code Online (Sandbox Code Playgroud)
匹配这个:
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
Run Code Online (Sandbox Code Playgroud)
您还会注意到,正如Eric所说(并且他最了解!!)新版本的ADT包括新project.properties中引用的默认proguard配置:
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Run Code Online (Sandbox Code Playgroud)
取消注释该行(删除#)将加载默认属性(proguard-android.txt),然后使用您在项目proguard-project.txt中所做的任何更改覆盖它.
这些默认属性包括Android Annotations项目推荐的许多规则,并且足以满足大多数基本应用程序的要求.
| 归档时间: |
|
| 查看次数: |
3822 次 |
| 最近记录: |