I am creating a Map based app on Android Platform . I am using Firebase Firestore as backend Database in this project. I wanted to add GeoFire in my Firestore database . I have added following dependencies in my gradle file to add Firestore and GeoFire in my project:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-firestore:17.1.2'
implementation 'com.firebase:geofire-android:2.3.1'
but after sucessfull gradle sync when i add
CollectionReference geoFirestoreRef = FirebaseFirestore.getInstance().collection("my-collection");
GeoFirestore geoFirestore = new GeoFirestore(geoFirestoreRef);
It gives Error 'Unable to resolve GeoFirestore'
I dont understand why this error appears although i have added all the required dependencies in my gradle file . Attached picture also.
The problem in your code is that you are trying to use GeoFirestore library for Android but you are using a dependency for GeoFire for Android, which is a total different product. GeoFirestore works with Cloud Firestore while GeoFire works with Firebase realtime database.
This is also the reason why you are getting the following error:
Because you are trying to create an object of
GeoFirestore
class which is a class that was not imported. In order to solve this issue, you need to add in your build.gradle file the corresponding GeoFirestore dependency:And in your build.gradle (project) file:
Here you can find more informations.