简体   繁体   中英

Firebase Exception “Found conflicting getters for name: isChangingConfigurations”

My app crashes on button click and log shows the Firebase Exception- "Found conflicting getters for name: isChangingConfigurations"

Here is the class..

public class tt extends AsyncTask<Void,Void,Void>
{ Member member = new Member();
    DatabaseReference  reff = FirebaseDatabase.getInstance().getReference().child("Member");
    doit ok = new doit();
    @Override
    protected Void doInBackground(Void... voids) {
        member.go();

        ok.setAd_id(member.ad_id);
        ok.setPrice(member.price);
        ok.setUsername(member.username);
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {        reff.push().setValue(ok);



            }
        });
        thread.run();
        return null;
    }

Here is the log....

05-12 18:24:44.824 23423-24354/com.example.btc E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: com.example.btc, PID: 23423
    java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:304)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: com.google.firebase.database.DatabaseException: Found conflicting getters for name: isChangingConfigurations
        at com.google.firebase.database.core.utilities.encoding.CustomClassMapper$BeanMapper.<init>(com.google.firebase:firebase-database@@19.3.0:477)
        at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.loadOrCreateBeanMapperForClass(com.google.firebase:firebase-database@@19.3.0:329)
        at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.serialize(com.google.firebase:firebase-database@@19.3.0:166)
        at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.convertToPlainJavaTypes(com.google.firebase:firebase-database@@19.3.0:60)
        at com.google.firebase.database.DatabaseReference.setValueInternal(com.google.firebase:firebase-database@@19.3.0:282)
        at com.google.firebase.database.DatabaseReference.setValue(com.google.firebase:firebase-database@@19.3.0:159)
        at com.example.btc.tt$1.run(tt.java:24)
        at java.lang.Thread.run(Thread.java:818)
        at com.example.btc.tt.doInBackground(tt.java:30)
        at com.example.btc.tt.doInBackground(tt.java:11)

Solved by using hash map....

public class tt extends AsyncTask<Void,Void,Void>
{ Member member = new Member();
    DatabaseReference  reff = FirebaseDatabase.getInstance().getReference().child("Member");
    doit ok = new doit();
    @Override
    protected Void doInBackground(Void... voids) {
        member.go();

        ok.setAd_id(member.ad_id);
        ok.setPrice(member.price);
        ok.setUsername(member.username);
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                HashMap<String,String>
                        Student = new HashMap<>();
                Student.put("Ad_id",ok.Ad_id);
                Student.put("Price",ok.Price);
                Student.put("Username",ok.Username);
                reff.push().setValue(Student);



            }
        });
        thread.run();
        return null;
    }


}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM