2016-08-01 96 views
3

我正在使用Android studio 2.1.1和gradle current version - 2.10。無法升級Android Studio中的gradle版本

我想gradle這個版本升級到2.14.1,爲此,我也做了以下內容:

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip 

build.gradle

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

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

一旦同步,我收到以下錯誤:

Error:Could not find com.android.tools.build:gradle:2.14.1. 
Searched in the following locations: 
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom 
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar 
    https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom 
    https://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jar 
Required by: 
    :MultiPanePlayer:unspecified 

我的項目級設置選擇了「使用默認gradle包裝(推薦)」選項。我錯過了什麼嗎?

+1

嘗試'com.android.tools.build:gradle這個:2.1.2'的編譯 –

+0

更新的一些細節,請 – jay

+1

不要」混淆使用android gradle插件對構建工具進行gradle。他們有不同的版本號。你想要的插件版本2.1.2 – Henry

回答

0

問題gradle插件沒有得到更新問題已解決 - 如果出現此錯誤,您應該將插件版本更新爲2.1.2,正如@Henry所提到的或2.3.1。 (小心它是2.1.2而不是2.12)。下面是示例項目級的build.gradle這解決了我的錯誤 -

// 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:2.3.1' 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
    } 
} 
相關問題