在Android上使用Firebase需要哪些ProGuard配置?

54
当使用Firebase SDK开发Android应用时,我不断收到警告和错误信息,如以下内容(在Eclipse中):
Warning ... can't find referenced class ...
Warning: there were ... unresolved references to classes or interfaces ...
You may need to specify additional library jars (using '-libraryjars') ...

很遗憾,Firebase没有关于使用ProGuard的官方文档。

当使用ProGuard混淆时,我需要哪些指令才能成功编译带有Firebase的应用程序版本?


请参阅配置ProGuard - Kato
不幸的是,这并没有解决Coinverse应用程序的Firebase问题。您可以在此处查看完整代码(https://github.com/AdamSHurwitz/Coinverse)。 - AdamHurwitz
1
在使用实时数据库时,是否有类似于使用ProGuard配置的Firebase Firestore数据库的配置,如_配置Proguard_部分所述? - AdamHurwitz
12个回答

0

它解决了我的问题

将此添加到您的proguard-rules文件中

-optimizations !class/merging/*

不幸的是,这并没有解决Coinverse应用程序的Firebase问题。您可以在此处查看完整代码(https://github.com/AdamSHurwitz/Coinverse)。 - AdamHurwitz

0
我已经添加了大家都展示过的相同的内容。
# Firebase
-keep class com.firebase.** { *; }
-keep class org.apache.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }
-dontwarn org.apache.**
-dontwarn org.w3c.dom.**

但是我也有这个我自己发现的,因为我找不到任何人添加它的。
-keep class com.google.android.gms.** { *; }

Firebase的服务对我来说非常完美:
动态链接、FireStorage、身份验证、实时数据库、Firestore。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接