Я могу обновить данные до firebase, поэтому в моем соединении, я думаю, нет проблем с моим соединением, но я не могу получить данные из firestore.
зависимости:
implementation 'com.google.firebase:firebase-messaging:11.6.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-firestore:17.0.4'
implementation 'com.google.firebase:firebase-database:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
implementation 'com.google.api-client:google-api-client:1.25.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.facebook.android:facebook-android-sdk:4.35.0"
код :
private TextView showusername;
private TextView showpassword;
private TextView showphone;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private CollectionReference memRef = db.collection("Member");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personal);
showusername = (TextView) findViewById(R.id.username);
showpassword = (TextView) findViewById(R.id.password);
showphone = (TextView) findViewById(R.id.phone);
}
@Override
protected void onStart() {
super.onStart();
memRef.whereEqualTo("name","王小名")
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
for (QueryDocumentSnapshot documentSnapshot : queryDocumentSnapshots){
Member mem = documentSnapshot.toObject(Member.class);
String name = mem.getName();
String password = mem.getPassword();
String phone = mem.getPhone();
showusername.setText(name);
showpassword.setText(password);
showphone.setText(phone);
}
}
});
}
logcat:
2020-02-24 14: 32: 08.625 3747-3840 /? E / FirebaseInstanceId: Сбой при получении токена: INVALID_SENDER
Я просто добавляю
implementation 'com.google.firebase:firebase-messaging:20.1.0'
в мои зависимости
, но сбой при sycning при сборке показывает
ERROR: Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.firebase:firebase-messaging:20.1.0] C:\Users\jack0\.gradle\caches\transforms-2\files-2.1\e40595c3c511248facbf0e003354fb90\jetified-firebase-messaging-20.1.0\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.google.firebase.messaging" to force usage (may lead to runtime failures)