Development issue/problem:

After switching to Androidx packages via the Android Studio Refactor -> Refactor to Androidx menu item .

I get the following mistake:

Error inflation and androidx.constraintlayout.widget.ConstraintLayout class

How can I solve this problem?

Solution 1:

Make sure the Restriction Presentation is updated to the latest version:

Implementation of androidx.constraint layout:constraint layout:1.1.3.

And replace your xml tags

с

where it appears with that abbreviation:

Windows : CTRL + SHIFT + R

Mac: CONTROL + OFFSET + D

Solution 2:

In AndroidStudio 3.3 RC2 I updated his solutions by -.

Implementation of androidx.constraint layout:constraint layout:1.1.2.

at the following address:

Implementation of androidx.constraint layout:constraint layout:1.1.3.

in build.gradle (Module: Application)

Pay attention:
This solution also applies to version 3.3 (according to comments below from FireZenk), 3.5.2 (according to comments below from user2350644).

Solution 3:

Simply replace

с

In the xml files of your project.

You can use substitution in the path to the macro shortcut (⇧⌘F or ⇧⌘R) and in windows (Ctrl+Shift+R).

Give here a description of the image

Solution 4:

In my case I tried solution 1, which still didn’t work. Then I used solution 2 at the same time as solution 1.

Solution 1

Update the current version of ConstraintLayout in the build.gradle file at application level.

С

Implementation of androidx.constraint layout:constraint layout:1.1.2.

At the following address:

Implementation of androidx.constraint layout:constraint layout:1.1.3.

Decision 2

Invalid cache and restart of Android Studio (if it still doesn’t work after applying solution 1).

File → Invalid Cache / Restart → Invalid Cache and Restart

I’ve used them both and it’s working really well for me.

Pay attention: Solution 1 is important.

Solution No 5:

I’ve had this problem, too. This problem only occurs with the restriction-dependent versions.
Use version 1.1.3 and hopefully your problem is solved:

Implementation of androidx.constraint layout:constraint layout:1.1.3.

Solution No 6:

There are two ways to add the ConstraintLayout:

Implementation com.android.support.constraint:constraraint-layout:2.0.0-alpha3.

then it should be used like this:

or with an android:

androidx.constraintlayout:constraintlayout:2.0.0-alpha3.

then you have to

Don’t mix those two.

Solution No 7:

Because Android Studio has been updated to version 3.3, it generates this error. I solved the problem by updating the version in the build.gradle layer of the Link Constraints application:

Implementation of androidx.constraint layout:constraint layout:1.1.2.

AN

Implementation of androidx.constraint layout:constraint layout:1.1.3.

Solution No 8:

Android Studio has been updated to version 3.3. Remove the previous version of theLayout restriction

In my case it was used

androidx.constraintlayout:constraintlayout:2.0.0-alpha3.

Thank you very much.

Solution No 9:

In my case I just had to update the androidx dependencies to the latest version.

EDIT You must check in build.gradle (app) for dependencies that contain an androidx. Android Studio gives you information about the latest versions of these dependencies. Use this information to change the version of the dependency.

Solution No 10:

In AndroidStudio 3.4 I had to downgrade to

Implementation of androidx.constraint layout:constraint layout:1.1.2.

to make it work again.

Good luck!

You May Also Like

Why Does Digital TV Keep Losing Signal?

It’s incredibly frustrating trying to watch a TV show that constantly loses…

Microsoft releases Windows 10 Build 21296

Microsoft today presented Windows 10 build 21296 to Insiders on the Dev…

Adobe Creative Cloud is draining the battery too fast

It also serves as the primary launch platform for Adobe products. From…

ERR_INTERNET_DISCONNECTED in Chrome [SOLVED] –

If your browser displays the ERR_INTERNET_DISCONNECTED error, it means that your browser…