猿问

导入 Firestore 和实现 addOnSuccessListener 的问题

我正在尝试使用 Cloud Firestore 来保存用户数据。我正在尝试https://firebase.google.com/docs/firestore/quickstart中显示的示例


你能告诉我缺少什么吗?


构建文件中的依赖项


dependencies {

    api files('libs/AudienceNetwork.jar')

    api files('libs/FacebookAdapter.jar')


    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.google.android.exoplayer:exoplayer:r2.4.2'

    implementation 'com.android.support:support-v13:28.0.0'


    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'


    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    implementation 'com.google.android.gms:play-services-drive:16.0.0'

    implementation 'com.google.android.gms:play-services-tasks:16.0.1'


    implementation 'com.google.firebase:firebase-core:16.0.6'

    implementation 'com.google.firebase:firebase-ads:17.1.2'

    implementation 'com.google.firebase:firebase-appindexing:17.1.0'

    implementation 'com.google.firebase:firebase-firestore:17.1.5'


}

进口


import com.google.firebase.analytics.FirebaseAnalytics;

import com.google.firebase.firestore.DocumentReference;

import com.google.firebase.firestore.FirebaseFirestore;

import com.google.firebase.firestore.CollectionReference;

import com.google.android.gms.tasks.OnSuccessListener; 


import android.app.Activity;

import android.app.AlertDialog;

import android.app.DatePickerDialog;

import android.content.ActivityNotFoundException;

import android.content.Context;

import android.content.Intent;

import android.content.SharedPreferences;

import android.content.pm.PackageInfo;

import android.content.pm.PackageManager;

import android.content.pm.ResolveInfo;

import android.content.pm.Signature;

import android.graphics.Bitmap;

import android.graphics.Color;

import android.graphics.Point;

import android.graphics.Rect;

import android.net.ConnectivityManager;

import android.net.NetworkInfo;

import android.net.Uri;

import android.os.AsyncTask;

import android.os.Build;

import android.os.Bundle;

import android.os.Environment;

import android.support.annotation.NonNull;

http://img2.mukewang.com/626a48d500013a0303050271.jpg

浮云间
浏览 167回答 1
1回答

犯罪嫌疑人X

为了解决这个问题,您需要再导入一个类和一个接口,以便调用addOnSuccessListener()对象CollectionReference并将OnSuccessListener对象作为参数传递。import com.google.firebase.firestore.CollectionReference; import com.google.android.gms.tasks.OnSuccessListener;
随时随地看视频慕课网APP

相关分类

Java
我要回答