2017-06-05 93 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 
}