Не удалось найти gradle-4.2.1.jar (com.android.tools.build:gradle:4.2.1)
У меня возникла проблема со сборкой проекта после обновления студии Android до 4.2.1 и версии Build Gradle до 4.2.1. И версия gradle в gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
Есть идея решить эту проблему?
Ошибка:
A problem occurred configuring root project Test.
> Could not resolve all artifacts for configuration :classpath.
> Could not find gradle-4.2.1.jar (com.android.tools.build:gradle:4.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.1/gradle-4.2.1.jar
> Could not find builder-4.2.1.jar (com.android.tools.build:builder:4.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/4.2.1/builder-4.2.1.jar
> Could not find bundletool-1.1.0.jar (com.android.tools.build:bundletool:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.1.0/bundletool-1.1.0.jar
> Could not find protos-27.2.1.jar (com.android.tools.analytics-library:protos:27.2.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/27.2.1/protos-27.2.1.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
-----------------------------------------------------------------------------------------
// project/build.gradle
buildscript {
ext.kotlin_version = 1.5.0
repositories {
google()
mavenCentral()
}
dependencies {
classpath com.android.tools.build:gradle:4.2.1
classpath org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2 ответа
Change your buildscript from this
repositories {
google()
mavenCentral()
}
Into this
repositories {
google()
jcenter()
mavenCentral()
}
У меня была эта проблема, и я решил ее с помощью обновления gradle:
из
classpath 'com.android.tools.build:gradle:4.2.1'
к
classpath 'com.android.tools.build:gradle:4.2.2'
обновите это до последней версии.