user1677237
user1677237

Reputation: 81

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

Upvotes: 1

Views: 794

Answers (2)

Farshad Khodamoradi
Farshad Khodamoradi

Reputation: 179

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.**

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007359

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.

Upvotes: 2

Related Questions