java - 我以前在 Android Studio 的 FirebaseAuth 中从未见过这样的错误
问题描述
我正在处理 SignUpActivity。
我以前做过这个工作,但我没有收到这种类型的错误。
这是我的注册活动:
public class SignUpActivity extends AppCompatActivity {
ActivitySignUpBinding binding;
private FirebaseFirestore firestore;
private FirebaseAuth auth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivitySignUpBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
//I erased the methods and more codes and I just keep it simple for you to understand the code.
//but if you run this code then it will give you an error.
//main error this below code giving
auth = FirebaseAuth.getInstance();
firestore = FirebaseFirestore.getInstance();
}
}
这是我的日志:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.vishal.kaitka.openqadmin, PID: 7293
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app.myapp/com.example.app.myapp.SignUpActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.app.myapp. Make sure to call FirebaseApp.initializeApp(Context) first.
解决方案
推荐阅读
- python-3.x - 无法从 stock.picking 报告 QWEB 中删除公司信息
- kubernetes - 使用单个卷从 secrets 或 configmaps 挂载多个文件
- c# - C# DateTimeOffset 到 DateTime 的转换
- c# - Linq 查询返回最便宜的产品,只有它是唯一的
- python - Python - 分配错误之前引用的局部变量
- spring-boot - Redisson 的连接池统计信息
- python - 使用来自 firestore 的数据填充 WTForms 选择字段
- mongodb - 一段时间后如何在mongoDB中自动重置字段的值?
- c# - 在 Android 上的 Unity 中运行 Python 程序
- javascript - 在 PHP 中使用锚标记的 href 传递 ID 时出错?