本文介绍了更新到 android studio preview 3.0 canary 3 后无法构建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我的 android studio preview 3.0 canary 3.在此之后,我尝试运行该项目,但显示以下错误.

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 后无法构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:11