我将应用程序中的firestore版本更新为最新版本,但我不太了解其中的一些更改。
我应该将QueryListenOptions转换为其他方法。
有人可以告诉我现在的样子吗?
目前,我收到一个错误:
NoClassDefFoundError:无法解决以下问题:Lcom / google / firebase / firestore / QueryListenOptions
Query query = dailyGoalsRef.orderBy("date", Query.Direction.ASCENDING);
FirestoreRecyclerOptions<DailyGoalsModel> firestoreRecyclerOptions = new FirestoreRecyclerOptions.Builder<DailyGoalsModel>()
.setQuery(query, DailyGoalsModel.class)
.build();
firestoreRecyclerAdapter =
new FirestoreRecyclerAdapter<DailyGoalsModel, DailyGoalsHolder>(firestoreRecyclerOptions) {
@Override
protected void onBindViewHolder(@NonNull DailyGoalsHolder holder, int position, @NonNull DailyGoalsModel model) {
String fragmentName = "dailyGoals";
holder.setGoalsList(context, userEmail, model, fragmentName);
}
@Override
public DailyGoalsHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.daily_goals_list, parent, false);
return new DailyGoalsHolder(view);
}
@Override
public int getItemCount() {
return super.getItemCount();
}
};
recyclerView.setAdapter(firestoreRecyclerAdapter);
应用程式:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
//Firebase_ui
implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:3.1.3'
//Google Play Services
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-plus:16.0.0'
implementation 'com.android.support:multidex:1.0.3'
项目:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
最佳答案
将应用程序级依赖项中的firebase UI版本更新为4.2.1并进行重建应该可以解决您的问题。
implementation 'com.firebaseui:firebase-ui-auth:4.1.2'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.2'
希望能有所帮助!