Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java GeoFireStore getLocation返回null_Java_Android_Firebase_Google Cloud Firestore_Geofirestore - Fatal编程技术网

Java GeoFireStore getLocation返回null

Java GeoFireStore getLocation返回null,java,android,firebase,google-cloud-firestore,geofirestore,Java,Android,Firebase,Google Cloud Firestore,Geofirestore,我尝试使用GeoFireStore设置、获取和查询位置 我首先尝试使用以下方法设置位置: geoFirestoreRef = FirebaseFirestore.getInstance().collection("Locations"); geoFirestore = new GeoFirestore(geoFirestoreRef); geoFirestore.setLocation( auth.getUid(), new GeoPoint(Lat_Coordinate,Lon_Coordi

我尝试使用GeoFireStore设置、获取和查询位置

我首先尝试使用以下方法设置位置:

geoFirestoreRef = FirebaseFirestore.getInstance().collection("Locations");
geoFirestore = new GeoFirestore(geoFirestoreRef);

geoFirestore.setLocation( auth.getUid(), new GeoPoint(Lat_Coordinate,Lon_Coordinate) );
geoFirestore.getLocation( auth.getUid(), new GeoFirestore.LocationCallback() {
    @Override
    public void onComplete(GeoPoint geoPoint, Exception e) {
        Log.d("ERROR", "Error getting documents: "  + e);

    }
} );
这一切都很好,并在我的数据库中创建了以下内容:

现在,我尝试使用以下方法获取位置以查看它是否正常工作:

geoFirestoreRef = FirebaseFirestore.getInstance().collection("Locations");
geoFirestore = new GeoFirestore(geoFirestoreRef);

geoFirestore.setLocation( auth.getUid(), new GeoPoint(Lat_Coordinate,Lon_Coordinate) );
geoFirestore.getLocation( auth.getUid(), new GeoFirestore.LocationCallback() {
    @Override
    public void onComplete(GeoPoint geoPoint, Exception e) {
        Log.d("ERROR", "Error getting documents: "  + e);

    }
} );
由于某种原因,即使我能在数据库中看到这个位置,它也无法得到任何信息

我得到异常:
java.lang.NullPointerException:Location不存在

有什么想法吗


谢谢

我在图书馆也遇到了这个问题。当我查看来源时,我看到了一点

所以我做了一个决定。您可以使用fork链接,也可以克隆存储库并修复第192行:

if (geoPoint != null)

我和图书馆也有这个问题。当我查看来源时,我看到了一点

所以我做了一个决定。您可以使用fork链接,也可以克隆存储库并修复第192行:

if (geoPoint != null)

例外从何而来?显示完整堆栈跟踪异常来自何处?显示完整堆栈跟踪