【问题标题】:Unable to Build Project after update to android studio preview 3.0 canary 3 [duplicate]更新到 android studio preview 3.0 canary 3 后无法构建项目 [重复]
【发布时间】:2017-11-05 23:20:21
【问题描述】:

我刚刚更新了我的 android studio preview 3.0 canary 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 :

【问题讨论】:

标签: android android-studio android-studio-3.0


【解决方案1】:

你需要做的主要事情是:

将您的项目级别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

执行此步骤后,您的项目仍无法编译,您需要按照所有说明 here 将您的应用程序 build.gradle 转换为新插件

【讨论】:

    【解决方案2】:

    根据更新更改您的 build.gradle (project_name) 的一行(classpath):-

    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
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-28
      • 2017-10-17
      • 1970-01-01
      • 2020-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多