简体   繁体   English

Firebase数据库与名称冲突的获取器:getAddress

[英]Firebase database conflicting getters for name: getAddress

Currently trying out Google's Places API and meanwhile trying to push a Place to my Firebase database. 目前正在试用Google的Places API,同时尝试将Place推送到我的Firebase数据库。 The code below tries to do that but errors out when it is called. 下面的代码尝试执行此操作,但是在调用它时出错。

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PLACE_PICKER_REQUEST) {
        if (resultCode == RESULT_OK) {
            Place place = PlacePicker.getPlace(this, data);
            String toastMsg = String.format("Place: %s", place.getName());
            Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();

            String userUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
            DatabaseReference userRef = database.getReference("users/" + userUid);

            userRef.setValue(place);
        }
    }
}

The error I get is as follows: 我得到的错误如下:

11-23 18:34:24.874 13155-13155/io.app.roomie E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.app.roomie, PID: 13155
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {io.app.roomie/io.app.roomie.MainActivity}: com.google.firebase.database.DatabaseException: Found conflicting getters for name: getAddress
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4089)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132)
    at android.app.ActivityThread.-wrap20(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6119)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: com.google.firebase.database.DatabaseException: Found conflicting getters for name: getAddress
    at com.google.android.gms.internal.zzamy$zza.<init>(Unknown Source)
    at com.google.android.gms.internal.zzamy.zzj(Unknown Source)
    at com.google.android.gms.internal.zzamy.zzca(Unknown Source)
    at com.google.android.gms.internal.zzamy.zzbz(Unknown Source)
    at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
    at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)
    at io.app.roomie.MainActivity.onActivityResult(MainActivity.java:81)
    at android.app.Activity.dispatchActivityResult(Activity.java:6932)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4085)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132) 
    at android.app.ActivityThread.-wrap20(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:154) 
    at android.app.ActivityThread.main(ActivityThread.java:6119) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

Sorry about the code formatting. 对不起,代码格式。 I couldn't get it to work otherwise. 我无法使其正常工作。

The class com.google.android.gms.location.places.Place is not meant to be directly saved into Firebase. com.google.android.gms.location.places.Place类并非旨在直接保存到Firebase中。

You should write a simple POJO class that contains only the fields you need from Place, copy the data, and save this simple object into the database. 您应该编写一个简单的POJO类,该类仅包含Place中所需的字段,复制数据并将此简单对象保存到数据库中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase数据库错误:找到名称冲突的getter:isAccessibilityFocusable - Firebase database error : Found conflicting getters for name: isAccessibilityFocusable Firebase 异常“发现名称冲突的 getter:isChangingConfigurations” - Firebase Exception “Found conflicting getters for name: isChangingConfigurations” 发现名称冲突的吸气剂:数据库异常 - Found conflicting getters for name:Database Exception com.google.firebase.database.DatabaseException:找到两个具有属性区分大小写的getter或字段 - com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: name com.google.firebase.database.DatabaseException:发现名称冲突的吸气剂:isChangingConfigurations - com.google.firebase.database.DatabaseException: Found conflicting getters for name: isChangingConfigurations “com.google.firebase.database.DatabaseException:发现名称冲突的吸气剂:isChangingConfigurations”android - "com.google.firebase.database.DatabaseException: Found conflicting getters for name: isChangingConfigurations" android 发现名称冲突的吸气剂 - Found conflicting getters for name 发现名称冲突的吸气剂:isImportantForAccessibility - Found conflicting getters for name: isImportantForAccessibility 找到名称冲突的吸气剂:isFocusable - Found conflicting getters for name: isFocusable 发现名称的冲突吸气剂:getText - found conflicting getters for name: getText
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM