13

I recently installed android studio 3 but The constraint layout shows a grey window..I tried everything but I couldn't fix the the problem

Thanks in advance for any help provided:

enter image description here

enter image description here

XML code:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    xmlns:android="schemas.android.com/apk/res/android"; 
    xmlns:app="schemas.android.com/apk/res-auto"; 
    xmlns:tools="schemas.android.com/tools"; 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.chihaoui.myapplication.MainActivi‌​ty"> 
</android.support.constraint.ConstraintLayout>
Pulak
  • 768
  • 7
  • 16
max taylor
  • 131
  • 1
  • 4

4 Answers4

17

I just helped make the project and earned

example

Den
  • 170
  • 1
  • 8
2

I had a similar problem. My case is resolved by adding the following lines on app/build.gradle:

implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation('com.android.support:appcompat-v7:28.0.0') {
    force = true
}

Note the force = true part.

Kartal Tabak
  • 760
  • 1
  • 7
  • 18
  • 1
    Alternatively, you can use the AndroidX Support Library instead of v7. Source: https://developer.android.com/topic/libraries/support-library/packages#v7 – MD Naseem Ashraf Mar 10 '19 at 07:02
2

in build.gradle, just change:

androidx.constraintlayout:constraintlayout:2.1.3

to

androidx.constraintlayout:constraintlayout:2.0.4
Muhtar
  • 1,506
  • 1
  • 8
  • 33
  • this worked for me, seems like 2.1.3 is broken with compiled 31 SDK. –  May 02 '22 at 14:38
0

Did you sync your project,I see that yellow message in gradle file if you didn't sync project it wouldn't work