本文介绍了更新至Android Studio Preview 3.0 Canary 3后无法建立专案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是更新了我的android studio预览版3.0 canary3.此后,我试图运行该项目,但显示以下错误.

I Just update my android studio preview 3.0 canary 3. After this I am trying to run the project but showing following error.

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 :

推荐答案

您需要做的主要事情是:

The main things you need to do are:

将项目级别build.gradle文件更改为:

Change your project level build.gradle file to:

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版本.

Change the distributionUrl of your gradle-wrapper.properties to the currently latest available release of Gradle.

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

完成此步骤后,您的项目仍无法编译,因此您需要遵循所有说明此处有关如何将您的应用程序build.gradle转换为新插件

After this steps your project could not compile yet, and you need to follow all the instructions here on how to convert your app build.gradle to the new plugin

这篇关于更新至Android Studio Preview 3.0 Canary 3后无法建立专案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 04:54