【发布时间】:2020-05-30 14:33:50
【问题描述】:
Glide 不会从存储 Firebase 中加载图片。
这是我添加的依赖项。
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.google.firebase:firebase-storage:16.0.4'
这是我使用的函数。
private void getUserInfo(){
mCustomerDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot.exists() && dataSnapshot.getChildrenCount()>0){
Map<String, Object> map = (Map<String, Object>) dataSnapshot.getValue();
if(map.get("name")!=null){
mName = map.get("name").toString();
mNameField.setText(mName);
}
if(map.get("phone")!=null){
mPhone = map.get("phone").toString();
mPhoneField.setText(mPhone);
}
if(map.get("profileImageUrl")!=null){
mProfileImageUrl = map.get("profileImageUrl").toString();
Glide.with(getApplication()).load(mProfileImageUrl).into(mProfileImage);
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
注意:在我将 Gradle 列表升级到 androidx 之前它运行良好
注册前
注册后
【问题讨论】:
-
这篇文章可能对你有帮助medium.com/@egemenhamutcu/…
-
您在 logcat 中看到的错误是什么?
标签: java android firebase firebase-storage android-glide