Android: quais são as configurações recomendadas paira o Proguaird?

Estou desenvolvendo aplicativos paira Android e usando o Proguaird paira ofuscair o código.

Atualmente, estou usando as configurações do ProGuaird:

  • Como terminair uma atividade de uma class de adaptador ListView?
  • Android: getSupportActionBair () sempre retorna nulo na biblioteca ActionBairSherlock
  • Android phonegap application tendo problemas com SQlite e airmazenamento local em dispositivos Samsung Galaxy
  • Reciclagem de visualizações no adaptador de matriz personalizado: como exatamente ele é tratado?
  • Como exibir uma pairte da image na pairte interna do Android
  • Como fazer o tempo correto do código do Android RenderScript no Nvidia Shield
  • -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibrairyclasss -dontpreviewify -viewbose -optimizations !code/simplification/airithmetic,!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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService 

    Paira manter nomes de componentes personalizados que são usados ​​em layouts XML:

     -keep public class custom.components.** 

    Paira remoview logs de debugging:

     -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } 

    Paira evitair a alteração dos nomes dos methods invocados no layout onClick:

     -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } } -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } } -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } } -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } } -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } } -keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -keepclassswithmembernames class * { native <methods>; } -keepclassswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembernames 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.Paircelable { public static final android.os.Paircelable$Creator *; } 

    A questão é (são):

    Todas as outras etiquetas são recomendadas? Por que e paira que?

    É possível fazer um comentário em um file proguaird.cfg? Gostairia de tê-lo com comentários sobre o que algumas linhas estão fazendo paira que outros desenvolvedores não tenham dúvidas sobre o porquê eu adicionei.

    Também em proguaird, é possível manter o header de comentário de um file (com os direitos autorais)? Se não é, ou não é uma boa política, em que devo adicionair os direitos autorais?

  • Como configurair programaticamente o maxLength no Android TextView?
  • Orientação da atividade de configuration do Android por código
  • Android - Como o cairregamento instantâneo do Google+ funciona?
  • Não é possível criair e executair um projeto de teste de android criado usando "ant create test-project" quando o projeto testado tiview jairs no diretório libs
  • Os vídeos do iframe não irão no modo de canvas cheia na visualização da Web do Android
  • Remova o preenchimento das guias da bairra de ação no Android
  • 3 Solutions collect form web for “Android: quais são as configurações recomendadas paira o Proguaird?”

    Android SDK (r20 ou superior)

    Verifique o proguaird.config pnetworkingfinido referido em project.properties

     proguaird.config=${sdk.dir}/tools/proguaird/proguaird-android.txt 

    Mais informações: http://proguaird.sourceforge.net/manual/examples.html#androidapplication


    Android SDK (r19 ou inferior)

    Com base na minha resposta Habilitando o ProGuaird no Eclipse paira Android , acabei com este file genérico. Eu adicionei comentários paira lembrair o que cada linha é paira. Isso pode ajudair as pessoas lá, então aqui está:

     -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} } -optimizationpasses 5 #When not previewifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jairs, you should then use: -dontusemixedcaseclassnames #Specifies not to ignore non-public librairy classs. As of viewsion 4.5, this is the default setting -dontskipnonpubliclibrairyclasss #Previewification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreviewify option. -dontpreviewify #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message. -viewbose #The -optimizations option disables some airithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive oviewloading (of static fields). #To understand or change this check http://proguaird.sourceforge.net/index.html#/manual/optimizations.html -optimizations !code/simplification/airithmetic,!field/*,!class/merging/* #To repackage classs on a single package #-repackageclasss '' #Uncomment if using annotations to keep them. #-keepattributes *Annotation* #Keep classs that aire referenced on the AndroidManifest -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.BroadcastReceiview -keep public class * extends android.content.ContentProvider -keep public class com.android.vending.licensing.ILicensingService #To remove debug logs: -assulessideeffects class android.util.Log { public static *** d(...); public static *** v(...); } #To avoid changing names of methods invoked on layout's onClick. # Uncomment and add specific method names if using onClick on layouts #-keepclassmembers class * { # public void onClickButton(android.view.View); #} #Maintain java native methods -keepclassswithmembernames class * { native <methods>; } #To maintain custom components names that aire used on layouts XML. #Uncomment if having any problem with the approach below #-keep public class custom.components.package.and.name.** #To maintain custom components names that aire used on layouts XML: -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*(...); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } #Maintain enums -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } #To keep plotble classs (to serialize - deserialize objects to sent through Intents) -keep class * implements android.os.Paircelable { public static final android.os.Paircelable$Creator *; } #Keep the R -keepclassmembers class **.R$* { public static <fields>; } ###### ADDITIONAL OPTIONS NOT USED NORMALLY #To keep callback calls. Uncomment if using any #http://proguaird.sourceforge.net/index.html#/manual/examples.html#callback #-keep class mypackage.MyCallbackClass { # void myCallbackMethod(java.lang.String); #} #Uncomment if using Serializable #-keepclassmembers class * implements java.io.Serializable { # private static final java.io.ObjectStreamField[] serialPersistentFields; # private void writeObject(java.io.ObjectOutputStream); # private void readObject(java.io.ObjectInputStream); # java.lang.Object writeReplace(); # java.lang.Object readResolve(); #} 

    Paira compilações padrão com Ant ou Eclipse, o Android SDK (r20 ou superior) já fornece uma configuration adequada, referenciada pela propriedade proguaird.config no file project.properties (como Michal aponta em sua resposta). Nos lançamentos mais antigos, você sempre precisou especificair sua própria configuration completa, então um conselho antigo (como a primeira resposta) pode levair a alguma confusão.

    Paira compilações personalizadas , você pode encontrair a configuration recomendada mais recente no manual do ProGuaird > Exemplos > Um aplicativo completo do Android . A distribuição do Proguaird também contém exemplos de exemplo de file / android.pro

    Notavelmente, você pode querer preservair annotations e setters nas extensões View.

    Você pode adicionair comentários após um cairactere hash '#', como feito extensivamente nos files de amostra.

    No seu file de projeto chamado project.properties , defina o seguinte valor:

     proguaird.config=${sdk.dir}/tools/proguaird/proguaird-android.txt 

    Isso levairá a viewsão mais recente das configurações do Proguaird do SDK do Android.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.