Firebase数据库错误:找到名称为isAccessibilityFocusable的冲突getter: [英] Firebase database error : Found conflicting getters for name: isAccessibilityFocusable

查看:174
本文介绍了Firebase数据库错误:找到名称为isAccessibilityFocusable的冲突getter:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


引起:com.google.firebase.database.DatabaseException:找到名称相冲突的获得者: isAccessibilityFocusable


同时尝试更新我的用户。


$ b User类是像这样

  public class User {
@PrimaryKey
String userName;
String groupName;
int totalMoney;
布尔转;
boolean hapyo;
布尔型盲;
@Exclude
TextView textView;
@Exclude
按钮bHapdiye,bChale,bShow,bHeram;

public Button getbHapdiye(){
return bHapdiye;
}

public void setbHapdiye(Button bHapdiye){
this.bHapdiye = bHapdiye;
}

public Button getbChale(){
return bChale;
}

public void setbChale(Button bChale){
this.bChale = bChale;
}

public Button getbShow(){
return bShow;
}

public void setbShow(Button bShow){
this.bShow = bShow;
}

public Button getbHeram(){
return bHeram;
}

public void setbHeram(Button bHeram){
this.bHeram = bHeram;
}

public TextView getTextView(){
return textView;
}

public void setTextView(TextView textView){
this.textView = textView;
}

public boolean isBlind(){
return blind;
}

public void setBlind(boolean blind){
this.blind = blind;


$ b $ public boolean isHapyo(){
return hapyo;
}

public void setHapyo(boolean hapyo){
this.hapyo = hapyo;
}

public boolean isTurn(){
return turn;
}

public void setTurn(boolean turn){
this.turn = turn;



public String getUserName(){
return userName;


public void setUserName(String userName){
this.userName = userName;
}

public String getGroupName(){
return groupName;
}

public void setGroupName(String groupName){
this.groupName = groupName;
}

public int getTotalMoney(){
return totalMoney;
}

public void setTotalMoney(int totalMoney){
this.totalMoney = totalMoney;




$ b我试图以这种方式更新用户 p>

  final User user1 = userList.get(0); 
user1.setTextView(tvUser1);
user1.setbChale(bChaleP1);
user1.setbHapdiye(bHapdiyeP1);
user1.setbHeram(bHeramP1);
user1.setbShow(bShowP1);
user1.setTurn(true);
setUsersTurn(user1.isTurn(),bHapdiyeP1,bChaleP1,bShowP1,bHeramP1);
setTurnInFirebase(user1);

setTurnInFirebase方法就像这样

 public void setTurnInFirebase(User user){
myRef.child(users)。setValue(user);





$ b因此,当我运行这个项目时,我得到了上面提到的错误。这可能是什么原因。 Thankyou

解决方案

您的用户包含一个 TextView Firebase将无法序列化/反序列化。为了允许将类写入Firebase数据库,请确保其仅包含您创建的简单类型或对象的属性:所谓的POJO - 普通旧Java对象。



或者,您可以通过注释来排除不受支持的属性(如 TextView ):

  @Exclude 
public TextView getTextView(){
return textView;
}

@Exclude
public void setTextView(TextView textView){
this.textView = textView;
}


I am getting this error:

Caused by: com.google.firebase.database.DatabaseException: Found conflicting getters for name: isAccessibilityFocusable

while trying to update my User.

The User class is like this

public class User {
@PrimaryKey
String userName;
String groupName;
int totalMoney;
boolean turn;
boolean hapyo;
boolean blind;
@Exclude
TextView textView;
@Exclude
Button bHapdiye,bChale,bShow,bHeram;

public Button getbHapdiye() {
    return bHapdiye;
}

public void setbHapdiye(Button bHapdiye) {
    this.bHapdiye = bHapdiye;
}

public Button getbChale() {
    return bChale;
}

public void setbChale(Button bChale) {
    this.bChale = bChale;
}

public Button getbShow() {
    return bShow;
}

public void setbShow(Button bShow) {
    this.bShow = bShow;
}

public Button getbHeram() {
    return bHeram;
}

public void setbHeram(Button bHeram) {
    this.bHeram = bHeram;
}

public TextView getTextView() {
    return textView;
}

public void setTextView(TextView textView) {
    this.textView = textView;
}

public boolean isBlind() {
    return blind;
}

public void setBlind(boolean blind) {
    this.blind = blind;
}


public boolean isHapyo() {
    return hapyo;
}

public void setHapyo(boolean hapyo) {
    this.hapyo = hapyo;
}

public boolean isTurn() {
    return turn;
}

public void setTurn(boolean turn) {
    this.turn = turn;

}

public String getUserName() {
    return userName;
}

public void setUserName(String userName) {
    this.userName = userName;
}

public String getGroupName() {
    return groupName;
}

public void setGroupName(String groupName) {
    this.groupName = groupName;
}

public int getTotalMoney() {
    return totalMoney;
}

public void setTotalMoney(int totalMoney) {
    this.totalMoney = totalMoney;
}
}

I am trying to update the User like this

final User user1 = userList.get(0);
    user1.setTextView(tvUser1);
    user1.setbChale(bChaleP1);
    user1.setbHapdiye(bHapdiyeP1);
    user1.setbHeram(bHeramP1);
    user1.setbShow(bShowP1);
    user1.setTurn(true);
    setUsersTurn(user1.isTurn(),bHapdiyeP1,bChaleP1,bShowP1,bHeramP1);
    setTurnInFirebase(user1);

The setTurnInFirebase method is like this

public void setTurnInFirebase(User user){
    myRef.child("users").setValue(user);
}

So when I run the project, I get the above mentioned error. What could be the reason for this. Thankyou

解决方案

Your user contains a TextView, which is a class that Firebase won't be able to serialize/deserialize.

To allow writing a class to the Firebase Database, make sure that it only contains properties of simple types or objects that you created: so called POJOs - Plain Old Java Objects.

Alternatively you can exclude the non-supported properties (such as the TextView) by annotating them:

@Exclude
public TextView getTextView() {
    return textView;
}

@Exclude
public void setTextView(TextView textView) {
    this.textView = textView;
}

这篇关于Firebase数据库错误:找到名称为isAccessibilityFocusable的冲突getter:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆