Fork me on GitHub

Android打包问题解决集

Glide

Android Q(Android 29以上的版本)在使用Glide 3.7.0中加载图片报错

Load failed for /storage/emulated/0/DCIM/Camera/mmexport1613496781289.png with size [286x286]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 root causes:
    java.io.FileNotFoundException(/storage/emulated/0/DCIM/Camera/mmexport1613496781289.png: open failed: EACCES (Permission denied))
    java.io.FileNotFoundException(open failed: EACCES (Permission denied))
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, LOCAL
Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.os.ParcelFileDescriptor, LOCAL
Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL

解决方案是manifest application中加上

android:requestLegacyExternalStorage="true"

关于打包资源合并

tools:replace="android:theme,android:appComponentFactory,android:allowBackup,android:networkSecurityConfig">

android:theme 用于解决 主工程主题和模块主题同名的问题,同理的还有android:allowBackup、android:icon
android:appComponentFactory用于解决Android java.lang.ClassNotFoundException: Didn’t find class “android.support.v4.app.CoreComponentFactory”
android:networkSecurityConfig用于解决Android P引入的HTTP协议问题
posted @ 2024-05-10 11:22  KevinAt2022  阅读(101)  评论(0)    收藏  举报