java - QueryListenOptions 的 ClassNotFoundException

标签 java android firebase build.gradle google-cloud-firestore

After upgrade latest version implementation 'com.google.firebase:firebase-firestore:16.0.0'

implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-functions:15.0.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'

以下代码:

FirestoreRecyclerOptions options = new FirestoreRecyclerOptions.Builder<Inventory>().setQuery(query, Inventory.class).build();

Inside setQuery(),it shows Cannot resolve symbol 'QueryListenOptions'

如何解决以上问题?

最佳答案

Firebase Release Notes解释了这一变化:

Replaced the DocumentListenOptions and QueryListenOptions classes with a MetadataChanges enum. Instead of calling addSnapshotListener() with either of those classes, use the enum:

addSnapshotListener(MetadataChanges.INCLUDE, ...)

截至 5 月 3 日,Firestore 文档尚未更新以包含 MetadataChanges。作为引用,这是反编译的类文件:

package com.google.firebase.firestore;

public enum MetadataChanges {
    EXCLUDE,
    INCLUDE;

    private MetadataChanges() {
    }
}

更新 FirebaseUI version 3.3.1使用 Firebase SDK 版本 15.0.0 构建。它与 Firestore 16.0.0 不兼容。由于您使用的是 FirebaseUI 3.3.1,因此必须使用 Firestore 15.0.0 进行构建。

关于java - QueryListenOptions 的 ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50159087/

相关文章:

java - Zookeeper示例-分布式数学计算

java - 无法对以下 TreeMap 进行排序

android - 如何让 ndk-build 创建名称类似于库的可执行文件?

javascript - Firebase:使用预留主机 URL 时未创建 Firebase 应用程序 '[DEFAULT]'

java - 我如何自动将博文发布到我的网站 (VS)

java - apache poi 4.0 条形图示例不起作用

android - ListView - setOnItemClickListener 不工作

java - 如何从文本文件中获取特定的行并在android中显示数组列表

javascript - 如何让我的脚本返回成功消息?

javascript - 如何解决我的 Cloud Functions 项目中的新 ESLint 错误?