2

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.
Mobile Test
  • 69
  • 1
  • 8

4 Answers4

2

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'
}
Paul Kumchi
  • 211
  • 4
  • 7
0

Please try using the following settings:

  implementation 'com.jakewharton:butterknife:10.2.1'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
Apostolos
  • 10,033
  • 5
  • 24
  • 39
Javad Dehban
  • 1,282
  • 3
  • 11
  • 24
0

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.

Samer Kasseb
  • 192
  • 3
  • 10
  • Samer I followed the same steps twice, it still causing same issue. Can you please advise what is the other root cause in this? – Mobile Test Jul 09 '20 at 14:40
  • Be sure to use those two lines **android.useAndroidX=true** and **android.enableJetifier=true** in gradle.properties – Samer Kasseb Jul 09 '20 at 20:08
  • 1
    Samer both line are set to true in gradle.properties. – Mobile Test Jul 10 '20 at 04:50
  • before it should be like that **implementation ‘com.android.support:appcompat-v7:28.0.0’ ** after migration should be **implementation ‘androidx.appcompat:appcompat:1.0.2’** check this also if the error stills send me your project and I will solve it to you. – Samer Kasseb Jul 10 '20 at 07:51
  • Samer it support upto implementation 'androidx.appcompat:appcompat:1.1.0' but not implementation 'androidx.appcompat:appcompat:1.0.2'. It says new version is 1.1.0 is available. Can you please confirm what is the other library required for this? – Mobile Test Jul 13 '20 at 03:35
-1

Please try using the following settings:

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

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

medgis
  • 1
  • 1
  • Welcome on SO! This is not really a new answer. If you think that mentioning “the latest version”, instead of 10.0.0, is worthwile, you should submit an edit to Paul’s or Javad’s answer (click on “Improve this answer” under the one you want to edit). – Maëlan Apr 17 '21 at 17:26