The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. for androidx

前端 未结 9 980
礼貌的吻别
礼貌的吻别 2020-12-13 08:34

I upgraded my android studio to 3.4 canary and now I cannot successfully build anymore due to the following error:

The given artifact contains          


        
相关标签:
9条回答
  • 2020-12-13 08:59

    For androidx simply upgrade your dependencies to version '10.0.0'

    dependencies {
    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
    }
    

    Look for documentation here

    0 讨论(0)
  • 2020-12-13 08:59

    Using the latest version of Butterknife resolved the issue. Use >= 9.0.0-rc2 (Butterknife Version) to support androidX. For the latest release check the link - https://github.com/JakeWharton/butterknife/releases

    0 讨论(0)
  • 2020-12-13 09:04

    Change

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    to

    <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">

    or other Material Themes. Got this error after starting New Project with "No Activity" in Android Studio 4.0.1

    0 讨论(0)
  • 2020-12-13 09:10

    Which version if Butterknife you use? Latest version 9.0.0-rc2 supports androidx.

    UPD: There is closed issue on butterknife's github repo. Temporary workaround

    Add android.jetifier.blacklist=butterknife-compiler to your gradle.properties file.

    0 讨论(0)
  • 2020-12-13 09:10

    update butterknife + invalidate cache and restart + sync gradle if buterknife not used just clear cache and restart

    0 讨论(0)
  • 2020-12-13 09:11

    My project doesn't use butterknife, but I had the same error "The given artifact contains a string literal with a package reference 'android.support.v4.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx " This what I did to solve it: Update your parceler version

    gradle build file

    Replace:

    annotationProcessor 'org.parceler:parceler:1.1.6'
    implementation 'org.parceler:parceler-api:1.1.6'
    

    With:

      annotationProcessor 'org.parceler:parceler:1.1.13'
      implementation 'org.parceler:parceler-api:1.1.13'
    

    0 讨论(0)
提交回复
热议问题