4

I am using Proguard and all is fine - apk inspections in Android Studio show obfuscated class names - i.e. all fragments are named a, b, etc. But I tried online decompiler (that uses Jadx) and this tool can remap original class names to the obfuscated ones. It seems that class.dex file in my apk still holds some information about original names. Is there any way to get rid of that?

-optimizations !code/allocation/variable

-overloadaggressively


-dontpreverify


-verbose

-keepattributes Signature
-keepattributes *Annotation*
-keepattributes LineNumberTable


-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**

-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.** { *; }

-keep public class     com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames class * implements android.os.Parcelable
-keepclassmembers class * implements android.os.Parcelable {
  public static final *** CREATOR;
}


-keep @interface android.support.annotation.Keep
-keep @android.support.annotation.Keep class *
-keepclasseswithmembers class * {
  @android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
  @android.support.annotation.Keep <methods>;
}

-keep @interface com.google.android.gms.common.annotation.KeepName
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
  @com.google.android.gms.common.annotation.KeepName *;
}

-keep @interface com.google.android.gms.common.util.DynamiteApi
-keep public @com.google.android.gms.common.util.DynamiteApi class * {
  public <fields>;
  public <methods>;
}

-dontwarn android.security.NetworkSecurityPolicy
-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
egoldx
  • 1,490
  • 1
  • 9
  • 14
  • Did you provide the debug APK to the online decompiler? If so, this is the expected behavior. Depending on how you configured Proguard it will not obfuscate your debug APK. Why? Because it would be hard to debug an obfuscated APK and while they are not meant to be public there is no need to Proguard it. Try to upload the signed APK instead. – DustyMan Mar 13 '17 at 15:41
  • I tried to upload my release apk, properly signed. – egoldx Mar 13 '17 at 15:42
  • Did you check in your manifest.xml if you specified android:debuggable="true"? – DustyMan Mar 13 '17 at 15:45
  • Nope, I did not :-/ and even cant see it as debuggable – egoldx Mar 13 '17 at 15:50
  • Then the problem is in your Proguard configuration. Please paste your configuration so I can pinpoint the problem. – DustyMan Mar 13 '17 at 15:51
  • Eddited. Still, I can see in mapping file, that class names are obfuscated and simple tools as dex2jar give me the same obfuscated names. Only that online tools is getting the names from somewhere – egoldx Mar 13 '17 at 15:58
  • Your Proguard configuration looks fine to me. I must admit, I am a little confused as why that website actually shows you the non obfuscated version of your APK while your dex2jar shows an obfuscated version. Did you upload a non obfuscated version to that website before uploading the obfuscated one? They might keep the first APK you uploaded in a cache. Try changing the version of your APK to see if it changes something. – DustyMan Mar 13 '17 at 16:40
  • Actualy I tried to decompile some version with less aggresive proguard rules earlier. I'm gonna try another app. – egoldx Mar 13 '17 at 17:02
  • I have the exact same problem, does anyone have an idea? – koraxis Jun 14 '17 at 11:51
  • Unfortunately not, I have this exact same problem, somehow it manages to get class names. – DFJ Jun 03 '20 at 08:46
  • JADX gets the names also – DFJ Jun 03 '20 at 09:11
  • @egoldx did you find the solution how to hide original name inside class.dex ? – paulsenjs Jan 12 '21 at 07:36
  • Actually, I haven't check if this is still an issue when using R8. Gonna check – egoldx Jan 13 '21 at 14:19

0 Answers0