SDK版本呈现问题

时间:2018-08-03 19:30:36

标签: android gradle sdk android-gradle

最近我已将Android Studio SDK版本API level 23更新为26。现在,我的较旧项目遇到了问题。我该如何解决这个问题?

  

错误是:无法加载LayoutLib:   com / android / layoutlib / bridge / Bridge:不受支持的major.minor版本   52.0(详细信息)

我的build.gradle错误是:

build.gradle screenshoot

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "..."
        minSdkVersion 26
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
}

enter image description here

1 个答案:

答案 0 :(得分:0)

请尝试

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.1.0"
    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
}