Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: proguard is not obfuscating the source

I have enabled proguard in project.properties:

proguard.config=proguard.cfg

My proguard.cfg does not disable obfuscation. But nothing is obfuscated.

I run the project build with

ant release.

Any bells ringing?


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

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

-keepclasseswithmembers class * { public (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 *; }


like image 393
Danail Avatar asked Oct 21 '22 18:10

Danail


2 Answers

You should make sure that your project is configured for your Android SDK:

android update project -p MyProjectDirectory

As of Android SDK r20, the ProGuard configuration file is split into several parts, which are specified in project.properties:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

The short project-specific configuration is defined in proguard-project.txt (no longer in proguard.cfg, like it was in older versions of the SDK). The SDK documentation may not be entirely up to date in this respect.

When you run ant release, you should see some logging output from ProGuard.

like image 72
Eric Lafortune Avatar answered Oct 24 '22 11:10

Eric Lafortune


@Thanks Danail, Today i just overcome from this problem .Just elaborating

android:debuggable Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not. The default value is "false".

For more details you can visit

http://www.vogella.com/tutorials/AndroidDebugging/article.html

like image 20
IntelliJ Amiya Avatar answered Oct 24 '22 12:10

IntelliJ Amiya