Closed ChinHairSaintClair closed 5 years ago
Hey ChinHairSaintClair,
Thank you for informing us about your problem. We will get back to you as soon as possible with a solution.
Regards, Nikhil Sridhar
On Fri, Aug 3, 2018 at 7:01 AM, ChinHairSaintClair <notifications@github.com
wrote:
Good day
I followed the link to 'Including GeoFirestore in your Android project'. However as soon it is imported and sync is running it ends with an error as said in the title.
App level gradle:
apply plugin: 'com.android.application'
android { compileSdkVersion 27 defaultConfig { applicationId "my_project" minSdkVersion 17 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' 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'
// Google implementation 'com.google.android.gms:play-services-maps:15.0.1' implementation 'com.google.android.gms:play-services-location:15.0.1' implementation 'com.google.android.gms:play-services-places:15.0.1' implementation 'com.google.code.gson:gson:2.8.2' // Firebase implementation 'com.google.firebase:firebase-core:16.0.1' implementation 'com.google.firebase:firebase-auth:16.0.2' implementation 'com.firebaseui:firebase-ui-auth:4.1.0' implementation 'com.google.firebase:firebase-firestore:17.0.4' // Firebase custom location finder implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1'
}
apply plugin: 'com.google.gms.google-services'
Project level gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:4.0.1' // google-services plugin }
}
allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } flatDir { dirs 'libs' } } }
task clean(type: Delete) { delete rootProject.buildDir }
Am I missing something ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/imperiumlabs/GeoFirestore-Android/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AaSzNrwb3-7YzNkMwbaQvxnrQK0Ccl89ks5uNFfKgaJpZM4VuApd .
Hey ChinHairSaintClair,
I tried following the same instructions to implement GeoFirestore in the example project, and everything seems to work.
I'm not exactly sure what's causing your error.
This is what the gradle files look like in the example project:
App Level Gradle -
apply plugin: 'com.android.application'
android { compileSdkVersion 28 defaultConfig { applicationId "org.imperiumlabs.geofirestoreexample" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // Android implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' implementation 'com.android.support.constraint:constraint-layout:1.1.2' implementation 'com.android.support:support-v4:28.0.0-alpha3' implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3' implementation 'com.android.support:multidex:1.0.3' // Test 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.1' implementation 'com.google.firebase:firebase-firestore:17.0.2' implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1' }
apply plugin: 'com.google.gms.google-services'
Project Level Gradle -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects { repositories { google() jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) { delete rootProject.buildDir }
Try to mimic these files as closely as possible and let us know if you still get the sync error.
Regards,
Nikhil Sridhar
On Fri, Aug 3, 2018 at 11:21 AM, Nikhil Sridhar nik.sridhar@gmail.com wrote:
Hey ChinHairSaintClair,
Thank you for informing us about your problem. We will get back to you as soon as possible with a solution.
Regards, Nikhil Sridhar
On Fri, Aug 3, 2018 at 7:01 AM, ChinHairSaintClair < notifications@github.com> wrote:
Good day
I followed the link to 'Including GeoFirestore in your Android project'. However as soon it is imported and sync is running it ends with an error as said in the title.
App level gradle:
apply plugin: 'com.android.application'
android { compileSdkVersion 27 defaultConfig { applicationId "my_project" minSdkVersion 17 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' 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'
// Google implementation 'com.google.android.gms:play-services-maps:15.0.1' implementation 'com.google.android.gms:play-services-location:15.0.1' implementation 'com.google.android.gms:play-services-places:15.0.1' implementation 'com.google.code.gson:gson:2.8.2' // Firebase implementation 'com.google.firebase:firebase-core:16.0.1' implementation 'com.google.firebase:firebase-auth:16.0.2' implementation 'com.firebaseui:firebase-ui-auth:4.1.0' implementation 'com.google.firebase:firebase-firestore:17.0.4' // Firebase custom location finder implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1'
}
apply plugin: 'com.google.gms.google-services'
Project level gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:4.0.1' // google-services plugin }
}
allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } flatDir { dirs 'libs' } } }
task clean(type: Delete) { delete rootProject.buildDir }
Am I missing something ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/imperiumlabs/GeoFirestore-Android/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AaSzNrwb3-7YzNkMwbaQvxnrQK0Ccl89ks5uNFfKgaJpZM4VuApd .
Good day theonlynick0430
Thank you for the quick response.
I found that if I set the following: compileSdkVersion targetSdkVersion to lower than SDK version 28, I get the issues mentioned above. Here is a screenshot:
Is there any way around this, or am I required to use SDK version 28
Regards
Sorry ChinHairSaintClair, but it looks like there is no way around. I apologize for the incovenience.
On Mon, Aug 6, 2018 at 4:15 AM ChinHairSaintClair notifications@github.com wrote:
Good day theonlynick0430
Thank you for the quick response.
I found that if I set the following: compileSdkVersion targetSdkVersion to lower than SDK version 28, I get the issues mentioned above. Here is a screenshot:
[image: image] https://user-images.githubusercontent.com/41445931/43713575-56f85580-997a-11e8-8fa3-2d86a2b2d4ca.png
Is there any way around this, or am I required to use SDK version 28
Regards
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/imperiumlabs/GeoFirestore-Android/issues/2#issuecomment-410674638, or mute the thread https://github.com/notifications/unsubscribe-auth/AaSzNmn0MsOY46YhL8wQQGxCfa9J_OTdks5uOCVKgaJpZM4VuApd .
Good day theonlynick0430
All good, should perhaps be listed in the readme as it wasn't very clear why the projects break upon import.
I ran into another issue. Not sure if I should open another ticket/thread or continue on in this one. The steps are as follows: I init the GeoFirestore with my collections reference. On the geoFirestore variable I execute 'queryAtLocation'. Then on the 'geoQuery' variable I add the 'addGeoQueryEventListener', I implement this interface in my class.
All these steps are in accordance with the example app. However when I try to execute 'setRadius' or 'setCenter' on the geoQuery I am met with the following error:
java.lang.NullPointerException: Attempt to read from field 'com.google.firebase.firestore.ListenerRegistration org.imperiumlabs.geofirestore.GeoQuery$GeoHashQueryListener.childAddedListener' on a null object reference
at org.imperiumlabs.geofirestore.GeoQuery.setupQueries(GeoQuery.java:212)
at org.imperiumlabs.geofirestore.GeoQuery.setRadius(GeoQuery.java:464)
at za.co.mjrsolutions.radarsearch.manager.FirebaseManager.updateGeoTrackingRadius(FirebaseManager.java:440)
at za.co.mjrsolutions.radarsearch.MapsActivity.setRadius(MapsActivity.java:445)
at za.co.mjrsolutions.radarsearch.theme.DefaultTheme.setRadius(DefaultTheme.java:217)
at za.co.mjrsolutions.radarsearch.theme.DefaultTheme$1.onState(DefaultTheme.java:93)
Am I missing something ? Should these methods only be requested on the 'geoFirestore' variable? Looking forward to your feedback. Regards
Hey ChinHairSaintClair,
We apologize that you are encountering these problems. To help better understand your situation could you please provide the code you described.
Regards, Nikhil Sridhar
On Mon, Aug 6, 2018 at 11:53 AM, ChinHairSaintClair < notifications@github.com> wrote:
Good day theonlynick0430
All good, should perhaps be listed in the readme as it wasn't very clear why the projects break upon import.
I ran into another issue. Not sure if I should open another ticket/thread or continue on in this one. The steps are as follows: I init the GeoFirestore with my collections reference. On the geoFirestore variable I execute 'queryAtLocation'. Then on the 'geoQuery' variable I add the 'addGeoQueryEventListener', I implement this interface in my class.
All these steps are in accordance with the example app. However when I try to execute 'setRadius' or 'setCenter' on the geoQuery I am met with the following error:
java.lang.NullPointerException: Attempt to read from field 'com.google.firebase.firestore.ListenerRegistration org.imperiumlabs.geofirestore.GeoQuery$GeoHashQueryListener.childAddedListener' on a null object reference at org.imperiumlabs.geofirestore.GeoQuery.setupQueries(GeoQuery.java:212) at org.imperiumlabs.geofirestore.GeoQuery.setRadius(GeoQuery.java:464) at za.co.mjrsolutions.radarsearch.manager.FirebaseManager.updateGeoTrackingRadius(FirebaseManager.java:440) at za.co.mjrsolutions.radarsearch.MapsActivity.setRadius(MapsActivity.java:445) at za.co.mjrsolutions.radarsearch.theme.DefaultTheme.setRadius(DefaultTheme.java:217) at za.co.mjrsolutions.radarsearch.theme.DefaultTheme$1.onState(DefaultTheme.java:93)
Am I missing something ? Should these methods only be requested on the 'geoFirestore' variable? Looking forward to your feedback. Regards
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/imperiumlabs/GeoFirestore-Android/issues/2#issuecomment-410814604, or mute the thread https://github.com/notifications/unsubscribe-auth/AaSzNtgtPVjZIkpcvtokKkRF0D3YoYazks5uOJCfgaJpZM4VuApd .
Good day theonlynick0430,
Unfortunately I am no longer able to provide the code as it was since I have moved on in my development. Like I said in my comment above I followed your example app. The only difference is when want to update my center/radius I called: geoQuery.setRadius and/or geoQuery.setCenter This was called in on map ready.
However I did get things going by setting the geoQuery again when I want to update the center and radius:
public void updateGeoTracking(double lat, double lng, int distance){
this.geoQuery = geoFirestore.queryAtLocation(new GeoPoint(lat, lng), distance);
this.geoQuery.removeAllListeners();
this.geoQuery.addGeoQueryDataEventListener(this);
}
The above method is called when map camera moves. I have yet to see any drawbacks.
Regards
Good day,
I have finally run into some drawbacks again. The method I used above won't give me any 'DocumentExited' events which I understand. So I wrote a little app to test the flow of your example app with the added functionality of setting the center and radius as the camera moves.
I am still getting this error:
java.lang.NullPointerException: Attempt to read from field 'com.google.firebase.firestore.ListenerRegistration org.imperiumlabs.geofirestore.GeoQuery$GeoHashQueryListener.childAddedListener' on a null object reference
at org.imperiumlabs.geofirestore.GeoQuery.setupQueries(GeoQuery.java:212)
at org.imperiumlabs.geofirestore.GeoQuery.setCenter(GeoQuery.java:442)
at za.co.mjrsolutions.radarsearch.MapsActivity$3$1$1.onFinish(MapsActivity.java:216)
at com.google.android.gms.maps.GoogleMap$zza.onFinish(Unknown Source)
at com.google.android.gms.maps.internal.zzd.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.maps.zzb.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:387)
at fb.b(:com.google.android.gms.dynamite_mapsdynamite@12874019@12.8.74 (040300-204998136):20)
at com.google.android.gms.maps.internal.g.a(:com.google.android.gms.dynamite_mapsdynamite@12874019@12.8.74 (040300-204998136):4)
at com.google.maps.api.android.lib6.gmm6.api.b.run(:com.google.android.gms.dynamite_mapsdynamite@12874019@12.8.74 (040300-204998136):8)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
The test app tries to simulate moving to a new location after the initial load has been done:
@Override
public void onMapReady(GoogleMap googleMap) {
Log.d(TAG, "onMapReady: ");
mMap = googleMap;
// Testing
// Entities & location
locationsRef = db.collection(ENTITIES_COLLECTION);
geoFirestore = new GeoFirestore(locationsRef);
// Add a marker in Sydney and move the camera
final LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
this.geoQuery = geoFirestore.queryAtLocation(new GeoPoint(-34, 151), 5);
//this.geoQuery.removeAllListeners();
this.geoQuery.addGeoQueryDataEventListener(this);
moveCameraToPosition(sydney, 5, new GoogleMap.CancelableCallback() {
@Override
public void onFinish() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
LatLng home = new LatLng(-27.9808797, 26.7658316);
mMap.addMarker(new MarkerOptions().position(home).title("My position"));
moveCameraToPosition(home, 5, new GoogleMap.CancelableCallback() {
@Override
public void onFinish() {
MapsActivity.this.geoQuery.setCenter(new GeoPoint(-27.9808797, 26.7658316));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
moveCameraToPosition(sydney, 5, null);
}
}, 1000);
}
@Override
public void onCancel() {
}
});
}
}, 1000);
}
@Override
public void onCancel() {
}
});
}
Am I missing something? As you can see I am assigning the listener and even commented out 'this.geoQuery.removeAllListeners();' to see if anything changes. Really looking forward to your feedback as I'm at a bit of a loss.
Regards
I close because it's been too long and new versions of the library are out so the problem should not be present anymore. If it still persists re-open the issue
Good day
I followed the link to 'Including GeoFirestore in your Android project'. However as soon it is imported and sync is running it ends with an error as said in the title.
App level gradle:
Project level gradle:
Am I missing something ?