最佳答案
如果您使用 Firebase 身份验证,则需要在 proguard 文件中添加以下行:
-keepattributes Signature
-keepattributes *Annotation*
上述文档链接为:Optional: Configure ProGuard
此外,根据文档如果您使用DataSnapshot.getValue(Class)或DatabaseReference.setValue(Object)来读写数据,您需要考虑混淆后模型对象如何序列化和反序列化,然后,您需要添加以下内容:
# Add this global rule
-keepattributes Signature
# This rule will properly ProGuard all the model classes in
# the package com.yourcompany.models. Modify to fit the structure
# of your app.
-keepclassmembers class com.yourcompany.models.** {
*;
}
关于java - Firebase找不到引用的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38818077/