简体   繁体   中英

can not upgrade compiled sdk version to 27

I use android studio 2.3.3 with compiled sdk version 26.I 've added https://maven.google.com to repositories in all projects block as it said, but still unable to change and sync support libraries.It comes with the "failed to resolve " message I do appreciate any help.

This is build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.example.xxx.yyyy"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}

And

    buildscript {
    repositories {
    jcenter()

    }
    dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'

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

 allprojects {
 repositories {
    jcenter()
    maven{ url "https://maven.google.com" }
    maven{ url "https://jitpack.io" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

https://my.pcloud.com/publink/show?code=XZCiM27ZPJBNBNv4WhHLDAaiU27xXLdkAyby

can not upgrade compiled sdk version to 27

You should set

compileSdkVersion 27
buildToolsVersion "27.0.3"

Then modify PROJECT LEVEL build.gradle section

  1. Upgrade tools.build:gradle
  2. Add google()

DEMO

buildscript {
repositories {
        maven {

        }
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com/' }
        maven { url 'https://jitpack.io' }
    }
}

App build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.1.0"
defaultConfig {
    applicationId "com.example.xxx.yyyy"
    minSdkVersion 16
    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'
    }
}

Project build.gradle:

buildscript {
    repositories {
    jcenter()

    }
    dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'

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

 allprojects {
 repositories {

 maven {
            url "https://maven.google.com"
            name 'Google'
        }

 maven{ url "https://jitpack.io" }

        jcenter()
        mavenLocal()
        mavenCentral()

      }
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Also, add this :

compile com.android.support:appcompat-v7:27.1.0

and delete this:

compile com.android.support:appcompat-v7:26.0.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM