当前位置: 首页 > 知识库问答 >
问题:

java.lang.NoSuch方法错误:类Lcom/google/Firebase/Firebase App中没有虚拟方法zzbqo()Z;或其超级类

蓝苗宣
2023-03-14

JAVAlang.NoSuchMethodError:Lcom/google/firebase/FirebaseApp类中没有虚拟方法zzbqo()Z;或者它的超类(声明'com.google.firebase.FirebaseApp'出现在/data/app/woolamania.in.woolamania-2/base.apk)在com上。谷歌。火基。数据库FirebaseDatabase。com上的getInstance(未知源)。谷歌。火基。数据库FirebaseDatabase。woolamania上的getInstance(未知源)。在里面羊毛症。家android上的onCreate(Home.java:32)。应用程序。活动performCreate(Activity.java:6093)

H类ome.java代码是-

公共类Home扩展AppCompat活动实现视图。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) {

        }
    });

共有1个答案

朱硕
2023-03-14

请确保您已在依赖项中写入以下内容:

dependencies {
  // ...
  implementation 'com.google.firebase:firebase-core:16.0.4'
  // for real-time database
  implementation com.google.firebase:firebase-database:16.0.3
}
 类似资料: