Could not find com.android.tools.build.gradle:3.0.0-alpha7

我是研究僧i 提交于 2019-11-28 09:38:10
Tim Castelijns

Follow the steps in the 3.0.0 plugin migration guide

Update gradle version

The new Android plugin requires Gradle version 4.1-milestone-1 or higher. If you're opening an existing project using Android Studio 3.0 Preview 5 or later, follow the prompts to automatically update an existing project to the compatible version of Gradle.

To update Gradle manually, update the URL in gradle-wrapper.properties as follows:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip

and

Apply the plugin

If you're opening an existing project using Android Studio 3.0 Preview 5 or later, follow the prompts to automatically update your project to the latest version of the Android plugin. To manually update your project, include the maven repo and change the plugin version in your project-level build.gradle file as follows:

buildscript {
  repositories {
    ...
    // You need to add the following repository to download the
    // new plugin.
    jcenter()
    google()
  }

  dependencies {

    classpath 'com.android.tools.build:gradle:3.2.1'  //Minimum supported Gradle version is 4.6
  } 
}
Pong Petrung

You try :

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

Credits: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

If you're in Android Studio 3.1 or higher, you're likely encounter such type of issue prompting by a Build window.

Simply click on the Add Google Maven repository and sync project option at right side and initiate another gradle sync.

It'll make the necessary changes in both gradle-wrapper.properties as well as build.gradle files.

Update gradle plugin : in gradle.properties file add this line distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

then apply ther plugin in build.gradle file :

buildscript {
repositories {
    ...
    // You need to add the following repository to download the
    // new plugin.
    google()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
}

}

the distributionUrl property inside gradle-wrapper.properties should be:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

that works for me

Brandon
  1. open the file path(just as the log said): file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/
  2. found this file

  3. just change classpath 'com.android.tools.build.gradle:3.0.0-alpha7' to classpath 'com.android.tools.build.gradle:* * * ' ; * * * is the exist gradle file;

    this problem is because of gradle file do not found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!