[英]I have a crash when I want to run my project
I'm still new in learning about Android application.我在学习 Android 应用程序方面还是新手。 I had a crash when I tried to run my Mainactivity.
当我尝试运行 Mainactivity 时发生了崩溃。 I designed a register layout, and I was trying to save all the registration information in Firebase, but the crash prevented me even from testing whether the database is working or not.
我设计了一个注册布局,并试图将所有注册信息保存在 Firebase 中,但崩溃使我什至无法测试数据库是否正常工作。
I have executed the app many times, and this is what Logcat told me:我已经多次执行该应用程序,这是 Logcat 告诉我的:
You need to edit your Application class that extends from android.app.Application
and initialize Firebase in the entire application process.您需要编辑从
android.app.Application
扩展的 Application 类,并在整个应用程序过程中初始化 Firebase。
public class TestApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
}
}
I found one solution for this issue and I want to share that with you.我为这个问题找到了一个解决方案,我想与您分享。 I had to go back and modify the dependencies in build.gradle
我不得不回去修改 build.gradle 中的依赖项
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
}`
and Also modify并且还修改
dependencies {
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
} }
According to Lovish-Pandey wrote that make sure that all the firebase dependencies have the same import version根据Lovish-Pandey写道,确保所有 firebase 依赖项具有相同的导入版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.