Android studio Glide v4框架导入
目前Glide最新版本为 4.11.0
Glide中文文档网址:https://muyangmin.github.io/glide-docs-cn/doc/download-setup.html
中文文档有详细的官方介绍
以下简述导入方法
打开Grade文件,添加依赖代码:
implementation ‘com.github.bumptech.glide:glide:4.11.0’
然后,点击右上角“Sync Now”
使用可能遇到的问题
不显示图片,并有如下一大串提示:
W/Glide: Load failed for /storage/emulated/0/DCIM/Camera/IMG_20200506_060056.jpg with size [1080x394]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 causes:
java.io.FileNotFoundException(/storage/emulated/0/DCIM/Camera/IMG_20200506_060056.jpg: open failed: EACCES (Permission denied))
java.io.FileNotFoundException(open failed: EACCES (Permission denied))
java.io.FileNotFoundException(open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, LOCAL
There was 1 cause:
java.io.FileNotFoundException(/storage/emulated/0/DCIM/Camera/IMG_20200506_060056.jpg: open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 cause:
java.io.FileNotFoundException(/storage/emulated/0/DCIM/Camera/IMG_20200506_060056.jpg: open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20200506_060056.jpg: open failed: EACCES (Permission denied)
Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.os.ParcelFileDescriptor, LOCAL
There was 1 cause:
java.io.FileNotFoundException(open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 cause:
java.io.FileNotFoundException(open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: open failed: EACCES (Permission denied)
Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL
There was 1 cause:
java.io.FileNotFoundException(open failed: EACCES (Permission denied))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.io.FileNotFoundException: open failed: EACCES (Permission denied)
遇到类似的问题可以换个API 27及以下的模拟器试试。
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 1401362462@qq.com