+-
给定的工件包含一个包含引用“android.support.v4.content”的字符串文字,无法安全地重写.对于androidx
我将我的 android工作室升级到3.4金丝雀,现在由于以下错误我无法再成功构建:

The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

更多细节:

Caused by: java.lang.RuntimeException: Failed to transform '.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife-compiler/9.0.0-SNAPSHOT/732f93940c74cf32a7c5ddcc5ef66e53be052352/butterknife-compiler-9.0.0-SNAPSHOT.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)

显然,它与Butterknife,androidx和Jetifier有关

有谁知道如何解决这个问题?

最佳答案
尝试将jetifier列入黑名单:

gradle.properties file:

android.jetifier.blacklist = butterknife.*\\.jar

您需要使用AGP的3.3.0-rc1和Kotlin Gradle插件的1.3.0版本:

buildscript {
    repositories {
        ...
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-rc01'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2'
    }
}
点击查看更多相关文章

转载注明原文:给定的工件包含一个包含引用“android.support.v4.content”的字符串文字,无法安全地重写.对于androidx - 乐贴网