Home > Back-end >  Android studio can't see the design?
Android studio can't see the design?

Time:02-08

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"
 android:id="@ id/container"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingTop="?attr/actionBarSize">
</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'
 implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
 implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
 implementation 'androidx.navigation:navigation-fragment:2.4.0'
 implementation 'androidx.navigation:navigation-ui:2.4.0'
 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

CodePudding user response:

I think it's related to the gradle script file verison issue just see your dependencies and change if its 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 !!

CodePudding user response:

Update your Constraintlayout dependency in your app level build.gradle and check:

implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
  •  Tags:  
  • Related