error inflating ConstraintLayout in android studio

前端 未结 8 2164
猫巷女王i
猫巷女王i 2020-12-06 16:25

I\'m having problems with Android Studio. I recently upgraded my SDK Manager to include;

compile \'com.android.support.constraint:constraint-layout:1.0.0-bet         


        
8条回答
  •  北海茫月
    2020-12-06 16:48

    I had the same issues. For me, the reason is my project "Automatically convert third-party libraries to use AndroidXhas". What to do? simply following two steps:

    1st step: Please check your gradle.properties, if you see the following lines, you might have the exact same issues as mine. You can firstly delete them.

    android.useAndroidX=true
    android.enableJetifier=true
    

    2nd step: in main activity, I changed

    import androidx.core.app.ActivityCompat;
    import androidx.core.content.ContextCompat;
    

    into

    import android.support.v4.app.ActivityCompat;
    import android.support.v4.content.ContextCompat;
    

    Everything works all of sudden!

提交回复
热议问题