Glide版本:
'com.github.bumptech.glide:glide:4.11.0'
加載圖片的代碼
Glide.with(this)
.load(imgLocalPath)
.into(imageView);
在使用的程序中,因為模擬器的問題一直使用Android8.0版本,手機又是9.0版本,專案sdk配置如下
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
選擇相冊中的圖片后在android10上一直顯示不出來,權限也都給了
發現manifest少了句配置
android:requestLegacyExternalStorage="true"
加在<application>標簽下
也可以把targetSdkVersion改為28及以下,但是不建議
原因是Android 10檔案存盤機制修改成了沙盒模式,APP只能訪問自己目錄下的檔案和公共媒體檔案Android10以下,還是使用舊的檔案存盤方式,Android 10即使獲取讀取權限,訪問外部存盤也受到了限制,
感謝https://www.jianshu.com/p/ba6419bc9059
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/231460.html
標籤:其他
上一篇:2020-12-07 opencv:對`cv :: DescriptorMatcher‘的未定義參考
下一篇:Android:IOException read fail:EBADF (Bad file descriptor)
