skip to Main Content

Views stopped showing on Design Mode in Android Studio out of the blue (including the "hello world" textView). I haven’t updated anything or changed anything.
I tried the following solutions:

  1. (changing the theme) This view is not constrained android studio. I can not see the button even if I use Infer Constraints
  2. inferring constraints.
  3. (can’t find the link) but the answer marked as correct said my SDK is corrupt -> updating it didn’t work.
    I’m suspecting Gradle is the culprit somehow, so here’s the app’s build script (a brand new project):

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    defaultConfig {
        applicationId "com.cc.take6"
        minSdkVersion 28
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

my android Studio is version: 3.6.3.
Any ideas? thank you in advance.

2

Answers


    • Make sure you are using the latest stable version of Android Studio and all related tools
    • Update your project to use latest version of Gradle and everything
    • File -> Invalidate Caches and Restart
    • Build -> Clean Project
    • Build -> Rebuild Project
    • Run
    Login or Signup to reply.
  1. I fixed the problem by changing the version of contraintLayout implementation that I was using. I added to the file build.gradle(:app):

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