I'm trying to figure out how Firebase will do the mapping from obfuscated code to real code and according to their docs, I need to add this line -
-keepattributes SourceFile,LineNumberTable
This is supposed to keep the file names and line numbers intact. However, despite using this configuration, I noticed that after decompiling my APK, it contains obfuscated file names like a.java, b.java etc. Additionally, I read in this answer that the SourceFile
is just a String which can be renamed. I don't understand this.
My questions are
- What is the
SourceFile
attribute? - Why does keeping the
SourceFile
attribute still obfuscate the files despite the documentation saying that file names are kept intact? - Why is the
SourceFile
attribute re-namable?
These options refer to the file names and line numbers that are part of a stack trace. The names for classes, methods, etc. are still obfuscated. Firebase can use your mapping file to translate these obfuscated names to their original names.
In case you need to preserve the names of the classes, methods, etc. you can set up
-keep
rules to do so as documented here under "Keep Options": https://www.guardsquare.com/manual/configuration/usageYou can see the impact your configuration has on your source tree by using the ProGuard Playground.