Hello everyone. When I obfuscate an app with R8 th...
# random
f
Hello everyone. When I obfuscate an app with R8 the ClassCastException is raised. Without R8 the cast work normally. Is there any channel here for discuss about that??
Copy code
java.lang.ClassCastException: java.lang.Float cannot be cast to u1.Z
    at J1.d.q(Unknown Source:142)
    at J1.d.j(Unknown Source:12)
    at C4.D.b(Unknown Source:260)
    at X5.w.j(Unknown Source:131)
    at X5.j.q(Unknown Source:11)
    at y5.a.s(Unknown Source:8)
    at T5.L.run(Unknown Source:112)
    at b6.a.run(Unknown Source:95)
    Suppressed: Z5.f: [u0{Cancelling}@513cb02, Dispatchers.Default]
πŸ‘€ 1
p
We need an R8 channel!
c
not kotlin but kotlin colored πŸ˜‰
How does the code look like?
p
Isn't r8 the default kotlin obfuscator?
c
No, it’s part of the Android Gradle plugin πŸ™‚
e
It actually could (and sometimes should) be used separately from Android, but I'm not sure if this community is the best place to get help with. Since we're in #C09222272 (so not technically off-topic) I can point you in the right direction. When the APK or AAB is built and R8 obfuscation is enabled a
mapping.txt
file will be generated that holds the mapping of the obfuscated symbols to the original ones. In your Android SDK directory under
cmdline-tools/latest/bin
there is a tool called
retrace
that you supply the path to your
mapping.txt
and then give it the stacktrace that you want to de-obfuscate.
f
Thank you all you, I use class name to do some logics, so the name was obfuscated and my logic was bad. I added
-keepclasseswithmembernames class *
and all works fine now.
πŸ˜… 1
πŸ‘ 1
πŸ‘πŸΎ 1
l
R8 has Kotlin specific rules @Chrimaeon, and it works also on non Android stuff. We have github.com/GradleUp/gr8 for example
πŸ‘ 1
c
yeah, sure, I know. Still it is a tool provided by Google and should not have a channel in this workspace.
πŸ†— 1
l
That's your opinion πŸ˜‰
There are a bunch of channels regarding Kotlin related tools made by various people or companies on this Slack
πŸ‘ 2