Android Studio 3.1.3, design view is always empty

后端 未结 7 1184
刺人心
刺人心 2021-02-02 10:56

I\'m new to android development and I have this problem with my Android Studio 3.1.3 demo project or any project that I create.

Even though that I can drag and drop diff

7条回答
  •  攒了一身酷
    2021-02-02 11:01

    I have been having the same problem and found that this hack worked for me. I have changed the versions in app file located in the Gradle Scripts/ build.gradle(Module:app) to versions 27. CompileSdkVersion, minSdkVersion, targetSdkVersion and implementation 'com.android.support:appcompat-v7:27.0.0'. These are listed on line 4,7,8 and 23.. (it might be different for you).

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.fiv4.masterapp"
            minSdkVersion 27
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    

提交回复
热议问题