简体   繁体   中英

Fragment's name are obfuscated in Firebase Performance Dashboard

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.

Firebase 性能监控仪表板

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 (eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM