简体   繁体   English

如何修复 androidx 中的“android.support.v4.content”?

[英]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.

相关问题 Android更新android.support.v4.content为androidx.core.content.FileProvider不留 - Android updating android.support.v4.content to androidx.core.content.FileProvider does not stay 如何修复第三方Cordova android插件中的``错误:包android.support.v4.content不存在'' - How to fix 'error: package android.support.v4.content does not exist' in 3rd party Cordova android plugin 给定的工件包含一个字符串文字,其中包含无法安全重写的包引用“android.support.v4.content”。 安卓版 - The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. for androidx package android.support.v4.content 不存在 flutter - package android.support.v4.content does not exist flutter 如何从android.support.v4.content膨胀中仅提取需要的(例如FileProvider)? - how to extract only the needed (e.g FileProvider) from the android.support.v4.content bloat? android.support.v4.content 和 android.support.annotations 不存在 - android.support.v4.content and android.support.annotations does not exist 错误找不到符号变量 FileProvider package android.support.v4.content 不存在 - Error cannot find symbol variable FileProvider package android.support.v4.content does not exist java.lang.IllegalAccessError:方法'void android.support.v4.content - java.lang.IllegalAccessError: Method 'void android.support.v4.content 如何修复androidx项目中不存在的包android.support.v4.app? - how to fix package android.support.v4.app not exist in androidx projects? AndroidX 没有找到类“android.support.v4.content.ContextCompat - AndroidX Didn't find class "android.support.v4.content.ContextCompat
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM