I'm making an android app using react native and this is the error I'm getting :
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
I'm getting the following warnings also :
> 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.
This is my build.gradle file :
// 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" } } }
This is my gradle wrapper distribution url :
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
I tried changing the order of different repositories and still getting the same error.
As seen the workaround from google issuetracker: https://issuetracker.google.com/issues/120759347#comment44
Seeing your error logs:
You are still searching for AGP 2.2.3 for your project
:react-native-fetch-blob
.For those React Native or CordovaLib projects that are with Android Gradle Plugin lower versions, e.g. 2.2.3, you can try to replace the
google()
with belowmaven
style, and add the android tools workaround. So, modify your top-levelbuild.gradle
file as below for bothbuildscripts
andallprojects
:Clean up your project and then perform a new Sync.
.gradle
and.idea
directory under your project root directory.See below references:
For the warnings:
Because you are using AGP (Android Gradle Plugin 3.2.1), the build configuration
compile
has changed toimplementation
andapi
. Just replace all thecompile
withimplementation
orapi
will let this warning disappear. See: https://developer.android.com/studio/build/dependencies#dependency_configurations for more details.This warning is just for your information, you can simply ignore it or remove
buildToolsVersion '25.0.2'
from yourbuild.gradle
file to suppress this warning.It seems com.android.tools.build:gradle:2.2.3 was removed from the jcenter repository.
Try adding this code to your top-level build.gradle file: