Android 加载大小为[0x0]的类为com.bumptech.glide.Load.engine.GlideException的null失败:收到null模型

Android 加载大小为[0x0]的类为com.bumptech.glide.Load.engine.GlideException的null失败:收到null模型,android,kotlin,imageview,android-glide,appglidemodule,Android,Kotlin,Imageview,Android Glide,Appglidemodule,我正在尝试加载我在firebase上保存的照片,保存成功,但无法再次加载图像。错误为 “加载大小为[0x0]的null失败 类com.bumptech.glide.load.engine.GlideException:收到空模型“ 我在代码中使用简单的行 override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState)

我正在尝试加载我在firebase上保存的照片,保存成功,但无法再次加载图像。错误为

“加载大小为[0x0]的null失败 类com.bumptech.glide.load.engine.GlideException:收到空模型“

我在代码中使用简单的行

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    currentUser?.let{user ->
        Glide.with(this)
            .load(user.photoUrl)

            .into(image_view)
我在Build.Gradle上的实现

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'com.google.firebase:firebase-firestore:21.4.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.2.1'
implementation 'androidx.navigation:navigation-ui:2.2.1'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
在Gradle.Build上应用插件

apply plugin: 'kotlin-kapt'
谢谢你以后的回答

顺便说一句,这是我完整的代码片段

类NotificationsFragment:Fragment(){

}

我修复了它,我不得不添加一些代码和编辑一些太,这是修复,所以它会保存的网址和照片

private  fun uploadImagetoFirebaseStorage(){
    if (selectedPhotoUri == null) return
    val filename = UUID.randomUUID().toString()
    val ref = FirebaseStorage.getInstance().getReference("/images/$filename")

    ref.putFile(selectedPhotoUri!!)
        .addOnSuccessListener {
            Log.d("dsa","$it")
            ref.downloadUrl.addOnSuccessListener {
                it.toString()

                saveUsertoFirebaseDatabase(it.toString())
            }
        }

}

private fun saveUsertoFirebaseDatabase(profileImageUrl: String){
    val uid = FirebaseAuth.getInstance().uid ?: ""
    val ref = FirebaseDatabase.getInstance().getReference("/users/$uid")
    val user = User(uid,username_edittext_register.text.toString(),profileImageUrl)

    ref.setValue(user)
        .addOnSuccessListener {
            Log.d("","Saved!!!!!!")
        }


}
}

类用户(val-uid:String,val-username:String,val-profileImageUrl:String)

然后我使用了滑翔模块,就像你们通常使用的一样

currentUser?.let{user ->

        Glide.with(this)

            .load(user.photoUrl)

            .into(image_view)


    }

确保您在firebase数据库中输入了相同的名称,例如-我正在尝试在我的应用程序中发送图像,在我的模型中,我声明了一个字符串“imageUrl”,但在firebase存储中,我输入了名称“image”,确保两个名称相同。。。。它将解决这个问题

在Glide尝试加载它们并在日志中检查它们的值之前,您是否尝试过记录
user.photoUrl
image\u view
?尝试过,仍然只是说同样的事情它只是想将值打印到日志中。这两个的打印值是多少?它是日志d。密码?在Logcat中显示“2020-03-16 14:19:29.777 7042-7042/com.example.opinionator W/Glide:Load失败,大小为[100x50]的类为com.bumptech.Glide.Load.engine.GlideException:Received null model”,我的意思是添加类似于
Log.d的内容(“我的日志标签,photoUrl:+user.photoUrl+”imgView:+image\u视图)
在滑翔机加载并检查日志中的文本之前。
currentUser?.let{user ->

        Glide.with(this)

            .load(user.photoUrl)

            .into(image_view)


    }