android: API=16,17,18で、Cloud Firestoreからdocumentを取得できない

AndroidプロジェクトにFirebaseを追加する | Firebase には、

API レベル 16(Jelly Bean)以降が対象です。

とあります。

ところが、API=16、API=17、API=18で、Firestoreからドキュメントを取得できません。

firebase-firestoreのversionは、20.1.0です。17.1.5も試しました。

// app/build.gradle

implementation 'com.google.firebase:firebase-firestore:20.1.0'Code language: JavaScript (javascript)
docRef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
    @Override
    public void onEvent(DocumentSnapshot doc, FirebaseFirestoreException e) {
  // ここでブレークポイント。doc も null、e も nullだった。Code language: JavaScript (javascript)

AVDでデバッグトレースすると、API=16、API=17、API=18で、onEventの引数docもnull、eもnullでした。

原因がわからないので、あきらめました。

API=16、API=17、API=18のときは、webからjsonファイルをダウンロードするようにしました。

タイトルとURLをコピーしました