skip to Main Content

I have been doing it in Android studio for a few days but I have never had such a problem 🙁

Background blank only text showing androidx.constraintlayout....ConstraintLayout

XML file

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

Gradle file

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

enter image description here

dependencies {
    classpath "com.android.tools.build:gradle:7.0.4"

    // NOTE: Do not place your application dependencies here; they 
    belong
    // in the individual module build.gradle files
}

2

Answers


  1. I think it’s related to the Gradle script file version issue just see your dependencies and change if it is outdated.. maybe this can help?

    dependencies {
        implementation 'androidx.appcompat:appcompat:1.3.1'
        implementation 'com.google.android.material:material:1.4.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
        testImplementation 'junit:junit:4.+'
        androidTestImplementation 'androidx.test.ext:junit:1.1.3'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    }
    
    

    and sync it !!

    Login or Signup to reply.
  2. Update your Constraintlayout dependency in your app level build.gradle and check:

    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search