https://kotlinlang.org logo
#random
Title
# random
c

Colton Idle

08/21/2022, 6:20 PM
Anyone use proguard or r8? According to https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android I have to add this for crashlytics to work. But if I "keep file names" doesn't that mean that obfuscastion isn't performed?
Copy code
-keepattributes SourceFile,LineNumberTable        # Keep file names and line numbers.
-keep public class * extends java.lang.Exception  # Optional: Keep custom exceptions.
y

Youssef Shoaib [MOD]

08/22/2022, 8:28 AM
File name is just an attribute in the classfile, it doesn't have to correspond to the name of the class inside at all. The Kotlin compiler even sets the file name to be
Foo.kt
for all classes inside Foo.kt, even if those classes aren't named
Foo
.
r

Robert Williams

08/22/2022, 9:05 AM
It will make your stack traces more readable but will also leak some information about the source in the build (assuming there's some relation between your file names and the classes within).
Definitely don't agree with their assertion that
you need to preserve the information
because you should be able to figure out the file yourself from the class name
All depends on how you balance risk vs developer convenience for your project
z

Zsolt.bertalan

08/22/2022, 9:42 AM
The SourceFile is needed for the LineNumberTable. You can add renameresourcefileattribute to overwrite all names in the class file: https://stackoverflow.com/questions/6727872/when-obfuscating-with-proguard-does-keepattributes-sourcefile-linenumbertable
r

Robert Williams

08/22/2022, 9:55 AM
Yep, using renameresourcefileattribute is the best way and Firebase doesn't say you can't do this (but they also don't explicitly recommend it)
c

Colton Idle

08/22/2022, 9:58 AM
Intersting. I opened https://issuetracker.google.com/issues/243294051 just for the hell of it a few hours ago. but thanks everyone this was helpful
19 Views