3

I just imported a project, but when i try to enter design view this shows up:Design view

My current gradle version is the latest 26.0.2 by the way. I'm not sure what to do, anyone have an idea?

Here are some Gradle Scripts:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion

    defaultConfig {
        applicationId "com.example.Ron.myapp"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

and

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Rengaw
  • 149
  • 2
  • 14

3 Answers3

1

I solved the problem myself. I upgraded the compileSdkVersion aswell as the minSdkVersion along with the dependencies. It now looks like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion

    defaultConfig {
        applicationId "com.example.Ron.myapp"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:cardview-v7:26.0.2'
}
Rengaw
  • 149
  • 2
  • 14
0

please update your support lib and compileSdkVersion like below.

compileSdkVersion   = 25
    buildToolsVersion   = "25.0.2"
    minSdkVersion       = 18 

    // Library versions
    supportLibraryVersion = "25.0.0"

also add ConstraintLauout gradle in gradle file.

compile 'com.android.support.constraint:constraint-layout:1.0.2'

For More details please check : https://stackoverflow.com/a/45115111/1343788

Mehul Kabaria
  • 6,404
  • 4
  • 25
  • 50
  • I tried downgrading it but it didn't work, the file explorer says the version 25.0.2 is ignored as it is below the minimum supported version 26.0.2 for Android Gradle Plugin 3.0.1, so it's using the latest 26.0.2 instead. – Rengaw Nov 23 '17 at 14:19
0

known problem just add

compile 'com.android.support.constraint:constraint-layout:1.0.2'

in your gradle file, it will fix it

Chief Madog
  • 1,738
  • 4
  • 28
  • 55