[英]How to fix 'android.support.v4.content' in androidx?
I migrated my android old project to androidx to use the updated library and fix the dependencies.我将我的 android 旧项目迁移到 androidx 以使用更新的库并修复依赖项。 But it still causing below issues.但它仍然导致以下问题。 And app is not get compiled.并且应用程序没有被编译。 How I can resolve this issues?我该如何解决这个问题? Is there any idea?有什么想法吗?
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.
Butterknife 10.0.0 added support for AndroidX. Butterknife 10.0.0 添加了对 AndroidX 的支持。 changing the butterknife dependency version solved it for me更改黄油刀依赖版本为我解决了它
dependencies {
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
}
Please try using the following settings:请尝试使用以下设置:
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
Follow these Steps.按着这些次序。
first of all migrate to AndroidX by updating your project use this version of the support library: version 28.0.0.首先通过更新您的项目迁移到 AndroidX 使用此版本的支持库:版本 28.0.0。
Refactor > Migrate to AndroidX from the menu bar.从菜单栏中重构 > 迁移到 AndroidX。
The refactor command makes use of two flags.重构命令使用两个标志。 By default, both of them are set to true in your gradle.properties file: android.useAndroidX=true默认情况下,它们在 gradle.properties 文件中都设置为 true: android.useAndroidX=true
The Android plugin uses the appropriate AndroidX library instead of a Support Library. Android 插件使用适当的 AndroidX 库而不是支持库。 android.enableJetifier=true The Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. android.enableJetifier=true Android 插件通过重写二进制文件自动迁移现有的第三方库以使用 AndroidX。
Please try using the following settings:请尝试使用以下设置:
implementation 'com.jakewharton:butterknife:(insert latest version)'实现“com.jakewharton:butterknife:(插入最新版本)”
annotationProcessor 'com.jakewharton:butterknife-compiler:(insert latest version)' annotationProcessor 'com.jakewharton:butterknife-compiler:(插入最新版本)'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.