简体   繁体   English

com.google.firebase.database.DatabaseException:找到两个具有属性区分大小写的getter或字段

[英]com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: name

Can Anyone check if there are error in my code 任何人都可以检查我的代码中是否有错误

 com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: name 
    ****package com.andisofttechnology.foodapp.model;
**
* Created by fullfocus on 8/25/2018.
*/
      public class User {
            public String Name,Password;
            public User(){
            }
            public User(String name,String password){
                Name = name;
                Password = password;
            }
            public String getName() {
                return Name;
            }
            public void setName(String name) {
                Name = name;
            }
            public String getPassword() {
                return Password;
            }
            public void setPassword(String password) {
                Password = password;
            }
        }


     com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: name

      SignIn.java

            package com.andisofttechnology.foodapp;

            import android.app.ProgressDialog;
            import android.support.v7.app.AppCompatActivity;
            import android.os.Bundle;
            import android.view.View;
            import android.widget.Button;
            import android.widget.EditText;
            import android.widget.Toast;

            import com.andisofttechnology.foodapp.model.User;
            import com.google.firebase.database.DataSnapshot;
            import com.google.firebase.database.DatabaseError;
            import com.google.firebase.database.DatabaseReference;
            import com.google.firebase.database.FirebaseDatabase;
            import com.google.firebase.database.ValueEventListener;
            import com.rengwuxian.materialedittext.MaterialAutoCompleteTextView;
            import com.rengwuxian.materialedittext.MaterialEditText;

             com.google.firebase.database.DatabaseException: Found two getters or fields with conflicting case sensitivity for property: name

            public class SignIn extends AppCompatActivity {
            EditText edtPhone,edtPassword;
                Button btnSignIn;
                @Override
                protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_sign_in);
                    edtPassword = (MaterialEditText) findViewById(R.id.edtPassword);
                    edtPhone = (MaterialEditText)findViewById(R.id.edtPhone);
                    btnSignIn = (Button)findViewById(R.id.btnSignIn);
                    //Init FireBase
                    FirebaseDatabase database = FirebaseDatabase.getInstance();
                    final DatabaseReference table_user = database.getReference("User");
                    btnSignIn.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            final ProgressDialog mDialog = new ProgressDialog(SignIn.this);
                            mDialog.setMessage("Please waiting...");
                            mDialog.show();

                            table_user.addValueEventListener(new ValueEventListener() {
                                @Override
                                public void onDataChange(DataSnapshot dataSnapshot) {

                                    //Check if user not exist in database
                                    if(dataSnapshot.child(edtPhone.getText().toString()).exists()) {

                                        //Get User Information
                                        mDialog.dismiss();
                                        User user = dataSnapshot.child(edtPhone.getText().toString()).getValue(User.class);
                                        if (user.getPassword().equals(edtPassword.getText().toString())) {
                                            Toast.makeText(SignIn.this, "Sign in sucessfully !", Toast.LENGTH_SHORT).show();
                                        } else {
                                            Toast.makeText(SignIn.this, "Sign in failed !!!", Toast.LENGTH_SHORT).show();
                                        }

                                        }else {
                                        mDialog.dismiss();
                                        Toast.makeText(SignIn.this,"User  not exist", Toast.LENGTH_SHORT).show();
                                    }
                                }

                                @Override
                                public void onCancelled(DatabaseError databaseError) {
            //Please check I Have a mistakes somewhere
                                }
                            });
                        }
                    });
                }
            }***

Found two getters or fields with conflicting case sensitivity for property: name 找到两个具有属性区分大小写的吸气剂或字段:名称

Your User MODEL class will be. 您的User MODEL类将是。

public class User {
            private String name,password;
            private User(){
            }
            public User(String name,String password){
                name = name;
                password = password;
            }
            public String getName() {
                return name;
            }
            public void setName(String name) {
                name = name;
            }
            public String getPassword() {
                return password;
            }
            public void setPassword(String password) {
                password = password;
            }
        }

try to change 尝试改变

Name to name Namename

Password to password Passwordpassword

in general, firebase using standard Java naming so you need to start any variable with small letter cases 通常,firebase使用标准Java命名,因此您需要以小写字母开头任何变量

暂无
暂无

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

相关问题 发现两个 getter 或属性的区分大小写冲突的字段:状态 - Found two getters or fields with conflicting case sensitivity for property: status com.google.firebase.database.DatabaseException:没有在类com.sale.organiccrops.organiccropsonsale.CartData上找到的要序列化的属性 - com.google.firebase.database.DatabaseException: No properties to serialize found on class com.sale.organiccrops.organiccropsonsale.CartData com.google.firebase.database.DatabaseException:无效的Firebase数据库路径 - com.google.firebase.database.DatabaseException: Invalid Firebase Database path com.google.firebase.database.DatabaseException 播放控制台错误 - com.google.firebase.database.DatabaseException Play Console Error com.google.firebase.database.DatabaseException:不支持字符,请输入字符串 - com.google.firebase.database.DatabaseException: Characters are not supported, please strings 构建为发行版APK后出现错误,但调试APK则没有错误-错误:发现两个吸气剂或区分大小写的字段 - Error after building as release APK but no error with debug APK - Error: Found two getters or fields with conflicting case sensitivity com.google.firebase.database.DatabaseException:无法将类型为java.lang.String的对象转换为类型 - com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.String to type 获取“com.google.firebase.database.DatabaseException:无法将java.lang.Long类型的值转换为String” - Getting “com.google.firebase.database.DatabaseException: Failed to convert value of type java.lang.Long to String” 错误:com.google.firebase.database.DatabaseException:无法将类型java.util.ArrayList的值转换为String - Error: com.google.firebase.database.DatabaseException: Failed to convert value of type java.util.ArrayList to String com.google.firebase.database.DatabaseException :反序列化时需要一个 Map,但得到一个类 java.lang.Long - com.google.firebase.database.DatabaseException : Expected a Map while deserializing, but got a class java.lang.Long
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM