我对Proguard和Firebase束手无策。Proguard似乎在我的Play Store应用程序的发布版本中引起了一个又一个问题。
这是目前在我的proguard-rules中的内容。支持文件:
-keepattributes Signature
-keepclassmembers class com.test.finalapp.models.** { *;}
-keep class com.test.finalapp.viewholders.** { *; }
-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
-keepattributes *Annotation*
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keepclassmembers class ** { public void onEvent*(**); }
我正在使用FirebaseUI RecyclerView适配器,该适配器的viewholder类在viewholder包名称中。这就是proguard的规则。文件是为。
附带问题:在proguard-rules文件中大小写重要吗?是否应该在"com.test.finalapp. net"中大写。如果我的包名为"viewholders"?
无论如何,这是最新的logcat错误,我不能弄清楚:
09-16 16:16:46.899 882-882/? E/UncaughtException: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at com.google.firebase.database.g.a(Unknown Source)
at com.test.finalapp.Activities.PreMainActivities.c.a(Unknown Source)
at com.google.firebase.database.p.a(Unknown Source)
at com.google.android.gms.c.ha.a(Unknown Source)
at com.google.android.gms.c.iv.b(Unknown Source)
at com.google.android.gms.c.jb.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5507)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-16 16:16:47.102 882-882/? D/FirebaseCrashApiImpl: throwable java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
--------- beginning of crash
09-16 16:16:47.141 882-882/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test.finalapp, PID: 882
java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at com.google.firebase.database.g.a(Unknown Source)
at com.test.finalapp.Activities.PreMainActivities.c.a(Unknown Source)
at com.google.firebase.database.p.a(Unknown Source)
at com.google.android.gms.c.ha.a(Unknown Source)
at com.google.android.gms.c.iv.b(Unknown Source)
at com.google.android.gms.c.jb.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5507)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我不知道什么"不能传递null参数'pathString'在child()"的意思,也没有什么调整来解决问题。想法吗?在发布这个问题之前,我在网上找不到任何解决方案…
我注意到,当把变量放在Android Studio手表窗口,其中一个是静态ref这样,因此StreetsId.PUSH_ID
country + "/"+ FirebaseManager.STREET_ADDRESS +"/"+ snapshot.child(StreetsId.PUSH_ID).getValue()
手表窗口确实在Android Studio调试器控制台窗口中产生了错误信息。