How to fix 'android.support.v4.content' in androidx?

Viewed 7230

I migrated my android old project to androidx to use the updated library and fix the dependencies. 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.
4 Answers

Butterknife 10.0.0 added support for 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.

  • Refactor > Migrate to AndroidX from the menu bar.

  • 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

  • The Android plugin uses the appropriate AndroidX library instead of a Support Library. android.enableJetifier=true The Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries.

Please try using the following settings:

implementation 'com.jakewharton:butterknife:(insert latest version)'

annotationProcessor 'com.jakewharton:butterknife-compiler:(insert latest version)'

Related