[英]Firebase error Can't pass null for argument 'pathString' in child()
I try to make a Database Reference in firebase but after run the program it showed java.lang.NullPointerException: Can't pass null for argument 'path string' in the child() Please tell me the proper solution我尝试在 firebase 中创建数据库引用,但在运行程序后显示 java.lang.NullPointerException: Can't pass null for argument 'path string' in the child() 请告诉我正确的解决方案
String receiverUid, senderUid;
DatabaseReference reference;
FirebaseDatabase database = FirebaseDatabase.getInstance();
reference = database.getReference("vcResponse").child(senderUid).child(receiverUid);
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.griffindor.postapp/com.griffindor.postapp.activities.calling.InCallingActivity}: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3312)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:226)
at android.app.ActivityThread.main(ActivityThread.java:7178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
Caused by: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
at com.google.firebase.database.DatabaseReference.child(DatabaseReference.java:96)
at com.griffindor.postapp.activities.calling.InCallingActivity.onCreate(InCallingActivity.java:74)
at android.app.Activity.performCreate(Activity.java:7383)
at android.app.Activity.performCreate(Activity.java:7374)
首先你需要保证receiverUid, senderUid是非空的首先你需要保证receiverUid, senderUid是非空的
First, you need to ensure that the receiverUid and senderUid are non empty首先需要保证receiverUid和senderUid不为空
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.