Hiding strings in Obfuscated code

Assuming you are happy with obscure rather than secure, there a number of mechanisms you could use, but obfuscaters like proguard are not going to be able to help you. To achieve this you will need to do encoding or encryption of the string yourself, the approach you use depends on what you are trying … Read more

Android: What are the recommended configurations for Proguard?

Android SDK (r20 or higher) Please check the predefined proguard.config refered in project.properties proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt More info: http://proguard.sourceforge.net/manual/examples.html#androidapplication Here you can check a proguard “default” file that I keep updating: https://medium.com/code-procedure-and-rants/android-my-standard-proguard-ffeceaf65521 Android SDK (r19 or lower) Based on my answer Enabling ProGuard in Eclipse for Android I’ve ended up with this generic file. I’ve added comments … Read more

Android ProGuard: Most Aggressive Optimizations

Remember that the best ProGuard configuration – is a configuration with a minimum of exceptions. Under the exceptions I understand: -keepclassmembers class * extends android.content.Context { public void *(android.view.View); public void *(android.view.MenuItem); } Let’s walk through proguard-android-optimize.txt and look on optimisation/obfuscation options. For detailed description of ProGuard options I use this -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* This – … Read more

How to debug with obfuscated (with ProGuard) applications on Android?

Add the following lines to your proguard configuration. -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable Now your stack traces will include line numbers, and by using the retrace tool that ships with proguard (included in the Android SDK), you are able to debug like normal. Note that even if you didn’t use these two configuration options, retrace still … Read more

ProGuard: can’t find referenced class com.google.android.gms.R

Although adding this to proguard-project.txt file works, it keeps all classes. -keep class com.google.android.gms.** { *; } -dontwarn com.google.android.gms.** I prefer this, which makes apk file size much smaller: -keep public class com.google.android.gms.* { public *; } -dontwarn com.google.android.gms.** Also note up to date Google Play Proguard notification here: http://developer.android.com/google/play-services/setup.html#Proguard -keep class * extends java.util.ListResourceBundle … Read more