2017-06-05 88 views
0

我剛剛更新我的Android工作室預覽3.0金絲雀3.這個我嘗試運行該項目,但顯示以下錯誤後後,生成項目。無法更新到Android工作室預覽3.0金絲雀3

Error:Could not find com.android.tools.build:gradle:3.0.0. 
Searched in the following locations: 
    file:/opt/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom 
    file:/opt/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar 
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom 
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar 
Required by: 
    project : 
+0

您應該閱讀此處以確保您已正確遷移到新插件:https://developer.android.com/studio/preview/features/new-android-plugin -migration.html – MatPag

+0

我回滾的問題原來的問題,你不應該要求它後更改的問題。 –

回答

6

你需要做的主要事情是:

更改項目級別build.gradle文件:

buildscript { 
    repositories { 
     ... 
     // 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-alpha3' 
    } 
} 

更改您的gradle-wrapper.properties的distributionUrl到當前最新的可用Gradle的發佈。

distributionUrl=https://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip 

此步驟後您的項目還不能編譯,你需要遵守所有有關如何將您的應用build.gradle轉換爲新的插件

0

更改build.gradle (project_name)的一個線上的指令hereclasspath )更新: -

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

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