Error inflating class androidx.constraintlayout.widget.ConstraintLayout

前端 未结 12 1162
佛祖请我去吃肉
佛祖请我去吃肉 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 19:04

    I use an Android Studio 4.1 and this library for constraint layout:

    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    which is updated on 09-Nov-20 and had the same error with inflating a Constraint Layout.

    In my case on my Samsung a40 app worked but on my ZTE nubia n1 app crashed instantly. I figured that a problem was in my layout background image because my png image was too big for an old device with a different screen resolution than the Samsung a40. I imported a background png image through the file explorer (drawable - right-click- Show in Explorer) and there was actually the problem.

    I tried to import images with Android Drawable Importer but I notice this plugin does not work anymore on Android Studio.

    SOLUTION RELATED TO ANDROID DRAWABLE IMPORTER:

    If you have already installed the Android Drawable Importer on your Android Studio please uninstall it before you start the process of repairing. To repair the Android Drawable Importer you need ADI-hack-plugin which you can get by following this youtube video from Thomas Samoul.

    After you repair the Android Drawable Importer just import your image with it and everything will work fine.

提交回复
热议问题