java.lang.NoSuchMethodError:类中没有虚方法zzbqo()Z. LCOM /谷歌/火力/ FirebaseApp;或其超级类(声明 ' com.google.firebase.FirebaseApp'出现在 /data/app/woolamania.in.woolamania-2/base.apk) 在com.google.firebase.database.FirebaseDatabase.getInstance(未知 资源) 在com.google.firebase.database.FirebaseDatabase.getInstance(未知 资源) at woolamania.in.woolamania.Home.onCreate(Home.java:32) 在android.app.Activity.performCreate(Activity.java:6093)
Home.java类的代码是 -
public class Home extends AppCompatActivity实现了View.OnClickListener {
TextView points;
Button freeRoll,lottery;
DatabaseReference mdatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Firebase.setAndroidContext(this);
mdatabase= FirebaseDatabase.getInstance().getReference("User");
Query query= mdatabase
.orderByChild("email")
.equalTo("aroravishal8991@gmail.com");
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(!dataSnapshot.exists()){
Toast.makeText(getApplicationContext(),"in first if and dsnap dont exist",Toast.LENGTH_SHORT).show();
}
for(DataSnapshot singleSnapshot: dataSnapshot.getChildren()){
if(singleSnapshot.exists()){
Toast.makeText(getApplicationContext(),"already exists",Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
答案 0 :(得分:0)
请确保您已将此代码写成依赖项:
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.4'
// for real-time database
implementation com.google.firebase:firebase-database:16.0.3
}