Error inflating class androidx.constraintlayout.widget.ConstraintLayout

前端 未结 12 1063
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 18:28

After migrating to Androidx packages using Android Studio menu option Refactor -> Refactor to Androidx...

I\'m getting the following error:

Error inf         


        
相关标签:
12条回答
  • 2020-12-29 18:51

    Make sure constraint layout is updated to latest version:

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    

    And replace your xml tag names

    <androidx.constraintlayout.ConstraintLayout>
    

    with

    <androidx.constraintlayout.widget.ConstraintLayout>
    

    in every place where it appears using this shortcut:

    Windows: CTRL + SHIFT + R

    Mac: COMMAND + SHIFT + R

    0 讨论(0)
  • 2020-12-29 18:51

    Since the Android Studio is updated to 3.3 it will pop this error. I resolved it by upgrading the version for constraint layout in the build.gradle of the app level:

    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'

    TO

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    0 讨论(0)
  • 2020-12-29 18:51

    In AndroidStudio 3.4 I had to downgrade to

    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    

    to get it working again.

    0 讨论(0)
  • 2020-12-29 18:52

    Android Studio is updated version 3.3. Please remove the previous version constraintLayout

    my case used this

    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    

    Thank you

    0 讨论(0)
  • 2020-12-29 18:54

    Just replace

    <androidx.constraintlayout.ConstraintLayout>
    

    with

    <androidx.constraintlayout.widget.ConstraintLayout>
    

    In your project's xml files.

    You can use Replace in Path shortcut in mac (⇧⌘F or ⇧⌘R) and windows (Ctrl+Shift+R)

    0 讨论(0)
  • 2020-12-29 18:59

    In AndroidStudio 3.3 RC2 I got it resolved by upgrading -

    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    

    to

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    

    in build.gradle (Module: app)

    Note: This solution is also valid for the release version 3.3 (as per below comment by FireZenk), 3.5.2 (as per below comment by user2350644)

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