2016-11-21 126 views
0

我是新來的Android,並在studio2.2 beta版本工作。 我的build.gradle文件內容如下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.gradle:2.0.0' 

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

allprojects { 
    repositories { 
     maven {url 'http://repo1.maven.org/maven2'} 
    } 
} 

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

但在同步,它給下面的錯誤

Error:Could not find com.android.tools.gradle:2.0.0:. 
Searched in the following locations: 
    file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.pom 
    file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.jar 
    https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.pom 
    https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.jar 
Required by: 
    :MyApplication:unspecified 

任何幫助嗎?

+0

如果你是新的,你爲什麼要使用測試版? –

+0

我應該使用哪個版本? @BartFriederichs –

回答

1

嘗試:

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

      // 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 
    } 
1

當前android gradle工具版本爲2.2.0,適用於android studio 2.2。此外,您現在可以使用的穩定版本,無需測試版

classpath 'com.android.tools.gradle:2.2.0' 

你也需要爲這個插件gradle這個2.14.1+

相關問題