在查询集合中使用率相等的地方时,在Firestore中获取错误。
获取错误UncaughtException:java.lang.ExceptionInInitializerError
,与第CollectionReference d = fire.collection("list");
行相同:
代码为
CollectionReference d = fire.collection("list");
d.whereEqualTo("data", "one").addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(QuerySnapshot snapshots, FirebaseFirestoreException e) {
if (e != null) {
Log.e("Error : ", "Unable to load list : " + e);
return;
}
List = new ArrayList<ListData>();
for (DocumentSnapshot doc : snapshots) {
final ListData l = doc.toObject(ListData.class);
assert l != null;
l.set_sem(doc.getId());
List.add(l);
}
recyclerView.setAdapter(adapter);
}
});
原木猫
UncaughtException: java.lang.ExceptionInInitializerError
at com.google.firebase.firestore.g.w.a(SourceFile:30)
at com.google.firebase.firestore.g.w.a(SourceFile:44)
at com.google.firebase.firestore.n.a(SourceFile:1151)
at com.project.activity.MainActivity.get_data(MainActivity.java:113)
at com.project.activity.MainActivity.onCreate(MainActivity.java:103)
at android.app.Activity.performCreate(Activity.java:6720)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2673)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2781)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1508)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to write to null array
at com.google.firebase.firestore.g.x.<clinit>(SourceFile:30)
at com.google.firebase.firestore.g.w.a(SourceFile:30)
at com.google.firebase.firestore.g.w.a(SourceFile:44)
at com.google.firebase.firestore.n.a(SourceFile:1151)
at com.project.activity.MainActivity.get_data(MainActivity.java:113)
at com.project.activity.MainActivity.onCreate(MainActivity.java:103)
at android.app.Activity.performCreate(Activity.java:6720)