我可以更新到 Firestore,但无法从我的文档中检索数据。我认为主要的问题是
无法反序列化对象。类 com.example.dotdot.Member 未定义无参数构造函数。如果您使用 ProGuard,请确保这些构造函数没有被剥离,这在 logcat 中显示。我不知道如何修复它。
我的代码 test.java:
public class test extends AppCompatActivity {
private EditText nameinput;
private EditText passwordinput;
private EditText phoneinput;
private TextView getinfo;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private DocumentReference accountRef = db.collection("Member").document();
private CollectionReference memRef = db.collection("Member");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
nameinput = findViewById(R.id.name);
passwordinput = findViewById(R.id.password);
phoneinput = findViewById(R.id.phone);
getinfo = findViewById(R.id.getinfo);
}
public void insertAccount(View v){
String name = nameinput.getText().toString();
String password = passwordinput.getText().toString();
String phone = phoneinput.getText().toString(); …Run Code Online (Sandbox Code Playgroud)