2017-02-23 2 views
0

나는이 오류가 무엇입니까 :중포 기지 데이터베이스 오류 : 이름 충돌 게터 찾았 isAccessibilityFocusable

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

내 사용자를 업데이트하는 동안.

사용자 클래스 내가 실행할 때 setTurnInFirebase 방법은 그래서

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

처럼이

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); 

같은 사용자를 업데이트하려고이

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; 
} 
} 

같다 프로젝트, 나는 위에서 언급 한 오류가 발생합니다. 이것에 대한 이유는 무엇 일 수 있습니다. 감사합니다

+0

을이 게시물이 문제에 대한 답을 생각한다 37802772 ...] (http://stackoverflow.com/a/37802772/4112725) – koceeng

답변

3

사용자에게 TextView이 포함되어 있습니다.이 파일은 Firebase가 직렬화/비 직렬화 할 수없는 클래스입니다.

클래스를 Firebase 데이터베이스에 쓰려면, POJOs - Plain Old Java Objects라고하는 간단한 유형이나 객체의 속성 만 포함해야합니다.

또는 당신이 그들을 주석에 의해 (예 : TextView 등) 지원되지 않는 특성을 제외 할 수 있습니다 : [http://stackoverflow.com/a/ :

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

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

Frank : 사용자가'textView' 필드 선언에 @Exclude를 가지고 있음에 유의하십시오. 귀하의 대답이 올바르게 표시되면, @ Exclude는 getter/setter에 있어야합니다. @Exclude에 대한 설명서에는 약간의주의가 필요합니다. [업그레이드 가이드] (https://firebase.google.com/support/guides/firebase-android#update_your_java_model_objects_numbered)에는 ​​필드 선언에 @Exclude가있는 예제가 포함되어 있습니다. @Exclude에 대한 문서 (https://developers.google.com/android/reference/com/google/firebase/database/Exclude)는 _ 필드를 데이터베이스에서 제외 된 것으로 표시합니다 _는 모호합니다. –

+0

아, 좋은 지적이야! 나는 현장에서 그것을 간과했다. 실제로 getter와 setter 모두에 있어야합니다. 한 곳에서만 필요로하는 공개적인 작업이 있지만 어디에서 결정해야하는지 까다로울 수 있습니다. –