我升级了我的 android studio to 3.4 canary
现在由于以下错误我无法成功构建:
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 and Jetifier
有人知道如何解决这个问题吗?
原文由 Tnaffh 发布,翻译遵循 CC BY-SA 4.0 许可协议
新的正确答案:
Butterknife 10.0.0 添加了对 AndroidX 的支持。
Butterknife < 10.0.0 的旧答案:
尝试将 jetifier 中的黄油刀列入黑名单:
您需要在 AGP 的 3.3.0-rc1 和 Kotlin Gradle 插件的 1.3.0 版本上: