Proguard doesn't confuse gui components

I would like to use ProGuard to obfuscate my Android app. It works great. But my gui classes, which extend the responsiveness, presentation and slocklockivity, are not confused. Here is proguard.cfg

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar
-libraryjars C:/Users/android-sdks/platforms/android-17/android.jar


-dontpreverify
-dontoptimize
-repackageclasses ''
-allowaccessmodification
-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keepattributes *Annotation*

-dontwarn    sun.misc.Unsafe
-dontwarn    com.actionbarsherlock.**
-dontwarn    com.google.common.**

-keep class android.support.v4.app.** { *; } 
-keep interface android.support.v4.app.** { *; } 
-keep class com.actionbarsherlock.** { *; } 
-keep interface com.actionbarsherlock.** { *; } 

-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.view.View
-keep public class * extends android.view.ViewGroup
-keep public class * extends android.support.v4.app.Fragment

-keepclassmembers class * extends android.app.Activity { 
public void *(android.view.View);
}
-keepclassmembers class android.support.v4.app.Fragment { 
*** getActivity(); 
public *** onCreate(); 
public *** onCreateOptionsMenu(...); 
}
-keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
public <init>(...); 
}

-keepclasseswithmembers class * {
   public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
  public <init>(android.content.Context, android.util.AttributeSet, int);
}


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

-keepclassmembers class * implements android.os.Parcelable {
    static android.os.Parcelable$Creator CREATOR;
}

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

-keepclassmembers class com.brainyoo.brainyoo2android.ui.html.BYJavaScriptInterface {
   public *;
}

Firstly, I thought the actions could not be confused due to the call of reflection

myactivity.class

I tried to add:

- keep public class mypackege.myactivity.class

But this does not solve the problem. Any ideas how to obfuscate gui elements?

Thanks Christina

+2
source share
1 answer

But my gui classes that extend acitvit, view and sherlockactivtiy do not get obfuscated.

, ProGuard , . , , , , :

  • Android .
  • Android .
  • Android ( )
  • .

: -keep public class mypackege.myactivity.class .

, ProGuard , .

, gui?

, , .

+3

All Articles