2017-06-20 41 views
11

kilka dni temu Zainstalowałem Android Studio 3.0 (podgląd), a następnie w wersji stabilnej (studio 2.3.3), gdy próbuję importować projekt, daje mi to błąd. W podglądzie wszystko działa poprawnie. to błąd:Nie można znaleźć gradle 3.0.0-alpha4

Error:Could not find com.android.tools.build:gradle:3.0.0-alpha4. 
Searched in the following locations: 
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom 
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar 
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom 
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar 
Required by: 
    project : 
+0

Możliwa duplikat [Nie można znaleźć com.android.tools.build:gradle:3.0.0-alpha1 w kręgu ci] (https://stackoverflow.com/questions/44071080/could-not-find-com-android-tools-buildgradle3-0-0-alpha1-in-circle-ci) –

Odpowiedz

29

If you're opening an existing project using Android Studio 3.0 Preview 1 or later, follow the prompts to automatically update your project to the latest version of the Android plugin. To manually update your project, include the maven repo and change the plugin version in your project-level build.gradle file as follows:

Otwórz swoją Poziom projektubuild.gradle Sekcja.

Powinieneś dodać maven { url 'https://maven.google.com' }.

Przykład

buildscript { 
     repositories { 
      jcenter() 
      // You need to add the following repository to download the new plugin. 
      maven { url 'https://maven.google.com' } 
     } 
     dependencies { 
      classpath 'com.android.tools.build:gradle:3.0.0-alpha4' // Same for alpha6 

     } 
    } 

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

Dodałem buildsctipt i allprojects ale to nie działa –

+0

Możesz podzielić się swoim 'build.gradle' –

+0

'Clean-Rebuild' i' Restart' IDE –

2

Lepszym sposobem może być po prostu użyć

buildscript { 
    repositories { 
     google() 
    } 

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