简体   繁体   中英

Obfuscate the folder structure - Android

I am developing a android application. I obfuscates the code of the project using progaurd. I want to obfuscate the folder structure as well. anyway to do that ?

Thanks for your help

ProGuard contains various directives , for your ProGuard rules file, that can obfuscate package names, such as -flattenpackagehierarchy and -repackageclasses . Just make sure that anything referenced from AndroidManifest.xml or otherwise accessed via reflection is kept intact.

It is conceivable that the commercial, Android-tuned DexGuard tool can even let you repackage stuff in the manifest (by modifying the manifest entries as part of the obfuscation process), but I do not know if it does or not.

copy and paste this code in proguard.cfg:

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-dontoptimize
-dontpreverify
-keepattributes *Annotation*
-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.BackupAgent
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v7.app.ActionBarActivity
-keep public class * extends android.app.Fragment
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
   native <methods>;
 }
-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*(...);
}

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM