Firebase - new dependencies - problem: NoClassDefF

2019-08-27 18:28发布

I updated the firestore version in my application to the latest one and I do not quite understand some changes.

I should convert QueryListenOptions to other methods.

Could someone tell me what it should look like now?

Currently, I get an error: NoClassDefFoundError: Failed resolution of: 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);

App:

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'

Project:

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.0.1'

1条回答
欢心
2楼-- · 2019-08-27 19:02

Updating the firebase UI version to 4.2.1 in app-level dependencies and rebuilding should fix your problem.

implementation 'com.firebaseui:firebase-ui-auth:4.1.2'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.2'

Hope that helps !

查看更多
登录 后发表回答