2016-08-17 61 views
6

搖籃發行Android Studio中2.1.3過Android Studio 2.1.3搖籃問題

我得到了這些錯誤,當我跑,我已經根據該Tutorial創建桌面應用。


我在哪裏可以找到Gradle 2.1.3?請幫幫我。我使用Libgdx框架。先謝謝你。

enter image description here

Error:Gradle: A problem occurred configuring root project 'Flapp Bird'. Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:2.1.3. Searched in the following locations: file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar

https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3. https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar

Required by: :Flapp Bird:unspecified

回答

20

的搖籃版本2.1.3存在,但不是在Maven中央,作爲所述here

要解決此問題,只需添加jcenter()mavenCentral()在生成腳本。

buildscript { 
    repositories { 
     mavenCentral() 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.3' 
    } 
} 
+0

我有完全相同的問題,這解決了它!謝謝! –

+0

**更新:** 非常感謝你先生** manelizzard ** 100%作品 –

0

據我所知,搖籃的最新版本是2.1.2。您可能會將gradle版本與gradle插件混淆。對您的類似問題也通過here解答,只需將'com.android.tools.build:gradle:2.1.3'更改爲2.1.2並且您應該設置。

+1

我已經嘗試設置2.1.3到2.1.2和2.1.0,但它給了我另一個錯誤 –

4

不,伊萬是對的。最新版本的Android Studio堅持要升級到Android插件for Gradle,修訂版2.1.3(2016年8月),Gradle 2.14.1或更高版本以及Build Tools 23.0.2或更高版本。 Studio Message 但它確實是,它打破編譯與錯誤的時刻:

Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:2.1.3. Searched in the following locations: 
+0

是的。我昨天更新了我的android工作室。我想這就是爲什麼我得到這個錯誤。 –

1
buildscript { 
    repositories { 
    mavenCentral() 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle-experimental:0.7.3' 
    classpath 'com.android.tools.build:gradle:2.1.3' 
    } 
} 

對於我添加此:classpath 'com.android.tools.build:gradle-experimental:0.7.3'並獲得成功。