My project has single activity architecture, where each screen is defined as a Fragment and we are using Firebase Performance to track frame metrics of it. Previously we have to create our screen tracer based on what firebase used beacuse Firebase only support screen performance metrics for Activities. When Firebase version to 20.1.0 is released, we are delighted that Firebase Performance support for out-of-the-box measurement of screen performance metrics for Fragments (source).
After we upgrade the firebase version, we notice that the Fragment screen name in Firebase Performance Monitoring Dashboard are obfuscated. It is happened because FragmentStateMonitor
uses fragment.getClass().getSimpleName()
and the fragment is obfuscated.
We have tried to look for the documentation so that we can use a custom screen name for each Fragments, but we don't get any results. There are already similar issues posted in firebase-android-sdk repository (https://github.com/firebase/firebase-android-sdk/issues/3737 and https://github.com/firebase/firebase-android-sdk/issues/3756) but I think those issues are different.
We already add new rules in our Proguard to keep Fragment names and it solves our issue, but we think that it will be the last option to keep Fragments names.
Is there any way to solve this other than add new rule to Proguard (e.g. by injecting screen name to FragmentStateMonitor
)?
Thanks :)
After digging more and more information, I decide to exclude Fragment
class name from obfuscation in proguard:
-keepnames class * extends com.nyapp.base.navigation.BaseFragment