首页 > 解决方案 > Proguard 的 Android FirebasePerformance 问题

问题描述

我们在我们的项目中实施了 FirebasePerformance,何时无法构建项目。我在 Proguard 中遇到错误,这与在外部库(qrchart_obfuscation.jar)中有两个具有相同名称但不同情况(A.class 和 a.class)的类有关。我对proguard也不是很熟悉。

通过阅读来源,我希望在 proguard 中添加 -dontwarn 选项,但这将是我最后的手段,因为来源说“只有在你知道自己在做什么时才使用它”。

我仍然尝试添加-dontwarn qr.android.chart并将 Mapping.txt 与我以前没有 FirebasePerformance 的构建进行比较,我看到类(qr.android.chart)的差异不确定这个细节是否有帮助

感谢您对 FirebasePerformance 的 proguard 设置的帮助和建议。

Reading program directory [C:\...\build\intermediates\transforms\FirebasePerformancePlugin\adevelop\release\4] (filtered)

Warning: class [qr/android/chart/b/a.class] unexpectedly contains class [qr.android.chart.b.A]
Warning: class [qr/android/chart/b/b.class] unexpectedly contains class [qr.android.chart.b.B]
Warning: class [qr/android/chart/b/c.class] unexpectedly contains class [qr.android.chart.b.C]
Warning: class [qr/android/chart/b/d.class] unexpectedly contains class [qr.android.chart.b.D]
Warning: class [qr/android/chart/b/e.class] unexpectedly contains class [qr.android.chart.b.E]
Warning: class [qr/android/chart/b/f.class] unexpectedly contains class [qr.android.chart.b.F]
Warning: class [qr/android/chart/b/g.class] unexpectedly contains class [qr.android.chart.b.G]
Warning: class [qr/android/chart/b/h.class] unexpectedly contains class [qr.android.chart.b.H]
Warning: class [qr/android/chart/b/i.class] unexpectedly contains class [qr.android.chart.b.I]
Warning: class [qr/android/chart/b/j.class] unexpectedly contains class [qr.android.chart.b.J]
Warning: class [qr/android/chart/b/k.class] unexpectedly contains class [qr.android.chart.b.K]

Warning: there were 11 classes in incorrectly named files.
         You should make sure all file names correspond to their class names.
         The directory hierarchies must correspond to the package hierarchies.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
         If you don't mind the mentioned classes not being written out,
         you could try your luck using the '-ignorewarnings' option.

我在构建已签名的 APK 期间看到了有关 Firebase 性能和 proguard 问题的链接,但情况不同 - Progaurd 中的 FirebasePerformance SDK 外部库问题

标签: androidandroid-proguardfirebase-performance

解决方案


问题是 qr.android.chart 库在保护时没有使用 dontusemixedcaseclassnames 选项。

在不区分大小写的文件系统(即 Mac OSX 喜欢使用的文件系统)上构建时,Firebase Performance 使用的字节码检测过程会遇到问题,因为未归档的类最终会相互覆盖。

您的选择是禁用字节码检测或请求激活 dontusemixedcaseclassnames 选项的新 qr.android.chart 库。


推荐阅读