0

buildTypes { release { minifyEnabled true shrinkResources = true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { debuggable true testCoverageEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') , 'proguard-rules.pro' } }

我也面临同样的问题 minifyEnabled true shrinkResources = true

fun updateImage(context: Context, imageName: String, imageView: ImageView) {
    if (imageView.tag?.equals(imageName.lowercase()) != true) {
        imageView.setImageDrawable(
            ContextCompat.getDrawable(
                context,
                context.resources.getIdentifier(
                    imageName.lowercase(),
                    "drawable",
                    context.packageName
                )
            )
        )
        imageView.tag =
            context.resources.getIdentifier(
                imageName.lowercase(),
                "drawable",
                context.packageName
            )
    }
}

我们怎样才能解决这个问题。?

4

1 回答 1

-1

尝试设置shrinkResourcesfalse

于 2022-02-18T08:37:55.463 回答