android - 从 Firebase 存储上传时出现 RuntimeException
问题描述
我试图从 Firebase 存储上传图像,并且 url 已经存在,但是代码在运行时崩溃了。它给出RuntimeException
了init()
方法。
我的kt代码:
private fun init() {
if (Common.currentUser !=null && Common.currentUser!!.avatar !=null && !TextUtils.isEmpty(Common.currentUser!!.avatar))
{
Glide.with(this).load(Common.currentUser!!.avatar).into(image_avatar)
//Toast.makeText(this,"Error "+Common.currentUser!!.avatar,Toast.LENGTH_SHORT).show()
//Snackbar.make(drawerLayout,"Error "+Common.currentUser!!.avatar,Snackbar.LENGTH_LONG).show()
}}
日志:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crazytaxi/com.example.crazytaxi.DriverHomeActivity}: java.lang.NullPointerException: Argument must not be null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3961)
在 com.example.crazytaxi.DriverHomeActivity.init(DriverHomeActivity.kt:118) 在 com.example.crazytaxi.DriverHomeActivity.onCreate(DriverHomeActivity.kt:68)
解决方案
推荐阅读
- jquery - jQuery获取最近的相邻元素
- excel - VBA - How to invoke Save button on a opened PDF in IE11 (No Sendkeys)
- python - Is there any function to assign values in a Pandas Dataframe
- django - 通过 Django 管理控制台上传的文件权限错误
- css - 使用 vue/nuxt 将样式属性附加到所有(锚)元素
- java - 如何运行输出文本的进程并将该文本在输出时写入 Javafx textArea?
- excel - 使用 VBA 从 excel 中删除连接时出错
- java - 如何用两条单独的数据解析一行文本?
- php - 教义 ORM:未定义的偏移量 2
- 32bit-64bit - RISC-V 32/64 位兼容性问题