我在 build.gradle 中使用此设置创建了新的 Android 应用程序
android {
compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.aviftest"
minSdkVersion 16
targetSdkVersion "S"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
我在 ImageView 中添加了用于图像加载的 Glide 库。在 ImageView 中加载图像的代码是
val url:String="https://petapixel.com/assets/uploads/2021/02/f1-good-a14c8cc5.avif"
Glide.with(this).load(url).centerCrop()
.placeholder(R.mipmap.ic_launcher)
.into(myImage);
日志中显示的错误说
W/Glide: Load failed for https://petapixel.com/assets/uploads/2021/02/f1-good-a14c8cc5.avif with size [198x198]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
安装应用程序后,Avif 图像未从源加载。这可能是什么原因?