简体   繁体   English

当我想运行我的项目时发生了崩溃

[英]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 告诉我的:

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.

相关问题 当我尝试在我的真实设备上运行我的项目时出现错误 - I have error when I try to run my project on my real device 将DFP广告管理系统添加到我的应用程序android时发生崩溃 - I have a crash when add DFP to my app android 我要建立解决方案时出现此错误 - I have this error when i want to build my solution 当我想在 Flutter 中调试我的应用程序时遇到问题 - I have problem when I want debug my app in Flutter 所以我几个月没有机会打开我的android项目了,这就是我现在运行它时发生的情况 - So i haven't have a chance to open my android project for a couple of months and this is what happens when i run it now 我的 Android 项目中只有一个活动,我想在不同的片段中显示不同类型的菜单 - I have only a Single Activity in my Android Project and I want to show different type of Menu in different Fragment 当MediaPlayer准备开始时,我想回到“活动主体”,但是我的应用程序崩溃了 - When MediaPlayer is preparing to start, i want go back to “activity main” but my application is crash 每次我想测试我的 android 游戏时,我都必须重新构建和运行吗? - Every time I want to test my android game I have to Build and Run all over again? 我在Android中具有复选框,图像视图和文本视图,我想在单击关联的文本视图时检查复选框 - I have checkbox, imageview and textview in android, I want to check my checkbox when i click the associated textview 运行项目时,我的应用程序未在模拟器上显示 - My app doesn't show on emulator, when I run the project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM