所以最近我尝试制作应用程序和长话短说,应用程序无法在我的模拟器上运行。 Android应用程序顺便连接到我的firebase。无论如何,应用程序一直停止。 logcat显示:https://i.stack.imgur.com/LA07Y.png。
我不确定我的数据库或Android工作室是否有问题,请告诉我如何修复它!
这是logcat:
06-15 15:50:32.375 17961-17961/com.oakieandco.verfundenproject E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.oakieandco.verfundenproject, PID: 17961
java.lang.NoSuchMethodError: No virtual method zzbqo()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.oakieandco.verfundenproject-2/split_lib_dependencies_apk.apk)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
at com.oakieandco.verfundenproject.Signin.onCreate(Signin.java:32)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
如果我没有弄错,它会引用我的代码的这一部分:
final FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference table_user = database.getReference("User");
signin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
table_user.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
User user= dataSnapshot.child(edtid.getText().toString()).getValue(User.class);
if (dataSnapshot.child(edtid.getText().toString()).exists()) {
if (user.getPassword().equals(edtpassword.getText().toString())) {
Toast.makeText(Signin.this, "Login successful", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(Signin.this, "Login unsuccesful", Toast.LENGTH_SHORT).show();
}
}
else{
Toast.makeText(Signin.this, "User not found.", Toast.LENGTH_SHORT).show();
}
}
然后我重新启动了应用程序,好的'logcat向我展示了这个:
模拟器:[10032]:警告:android / android-emu / android / base / async / AsyncSocketServer.cpp:99:接受主机连接时出错错误消息:未知错误
这是我的build.gradle部分:
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
答案 0 :(得分:0)
你是否在你的应用程序中使用了Proguard,而不是改变你的程序规则,这可能会限制该类加入到apk中
如果不是添加multidex库