Я делаю приложение для Android, используя react native, и получаю вот такую ошибку:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-fetch-blob'.
> Could not resolve all artifacts for configuration ':react-native-fetch-blob:classpath'.
> Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
project :react-native-fetch-blob
Я также получаю следующие предупреждения:
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
> Configure project :react-native-android-location-services-dialog-box
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Это мой файл build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// jitpack repo is necessary to fetch ucrop dependency
maven { url "https://jitpack.io" }
}
}
Это мой URL-адрес распространения оболочки Gradle:
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
Я попытался изменить порядок разных репозиториев, но все равно получаю ту же ошибку.
см. Issuesetracker.google.com/issues/120759347#comment30
Это проблема Google, но нужно подождать некоторое время, чтобы вернуть репозиторий google() в нормальное состояние.
Похоже, com.android.tools.build:gradle:2.2.3 был удален из репозитория jcenter.
Попробуйте добавить этот код в файл build.gradle верхнего уровня:
subprojects {project ->
if (project.name.contains('react-native-fetch-blob')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
Как видно из обходного пути от Google Issueetracker: https://issuetracker.google.com/issues/120759347#comment44
Просмотр журналов ошибок:
- What went wrong: A problem occurred configuring project ':react-native-fetch-blob'. Could not resolve all artifacts for configuration ':react-native-fetch-blob:classpath'. Could not find com.android.tools.build:gradle:2.2.3.
Вы все еще ищете AGP 2.2.3 для своего проекта :react-native-fetch-blob.
Для тех проектов React Native или CordovaLib, которые имеют более низкие версии Android Gradle Plugin, например 2.2.3, вы можете попробовать заменить google() на стиль ниже maven и добавить обходной путь с инструментами Android. Итак, измените файл высший уровеньbuild.gradle, как показано ниже, для buildscripts и allprojects:
buildscripts {
repositories {
// below is the workaround for android tools
maven {
artifactUrls "https://dl.bintray.com/android/android-tools/"
url "https://jcenter.bintray.com"
}
maven {
url "https://maven.google.com"
}
// ...
jcenter()
}
}
allprojects {
repositories {
// below is the workaround for android tools
maven {
artifactUrls "https://dl.bintray.com/android/android-tools/"
url "https://jcenter.bintray.com"
}
maven {
url "https://maven.google.com"
}
// ...
jcenter()
}
}
Очистите свой проект, а затем выполните новую синхронизацию.
.gradle и .idea в корневом каталоге проекта.См. Ссылки ниже:
Для предупреждений:
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
Поскольку вы используете AGP (Аndroid гradle пlugin 3.2.1), конфигурация сборки compile была изменена на implementation и api. Просто замените все compile на implementation или api, и это предупреждение исчезнет. См .: https://developer.android.com/studio/build/dependencies#dependency_configurations для более подробной информации.
WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Это предупреждение предназначено только для вашей информации, вы можете просто проигнорировать его или удалить buildToolsVersion '25.0.2' из файла build.gradle, чтобы подавить это предупреждение.
Не могли бы вы поделиться здесь файлом build.gradle приложения?