Android studio Glide v4框架导入

  1. Android studio Glide v4框架导入
    1. 目前Glide最新版本为 4.11.0
    2. 以下简述导入方法
    3. 使用可能遇到的问题

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

文章标题:Android studio Glide v4框架导入

字数:437

本文作者:百xiao生

发布时间:2020-05-11, 17:00:12

最后更新:2020-12-07, 15:12:00

原始链接:https://baixiaoshengzjj.top/2020/05/11/Android%20studio%20Glide%20v4%E6%A1%86%E6%9E%B6%E5%AF%BC%E5%85%A5/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。