19062

React Native : Could not find com.android.tools.build:gradle:2.2.3

Question:

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 :

<blockquote>

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

</blockquote>

I tried changing the order of different repositories and still getting the same error.

Answer1:

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:

subprojects {project -> if (project.name.contains('react-native-fetch-blob')) { buildscript { repositories { maven { url "https://dl.bintray.com/android/android-tools/" } } } } }

Answer2:

As seen the workaround from google issuetracker: <a href="https://issuetracker.google.com/issues/120759347#comment44" rel="nofollow">https://issuetracker.google.com/issues/120759347#comment44</a>

Seeing your error logs:

<blockquote> <ul><li>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.</li> </ul></blockquote>

You are still searching for AGP <strong>2.2.3</strong> for your project :react-native-fetch-blob.

For those <strong>React Native</strong> or <strong>CordovaLib</strong> projects that are with Android Gradle Plugin lower versions, e.g. 2.2.3, you can try to replace the google() with below maven style, and add the <strong>android tools workaround</strong>. So, modify your <strong>top-level</strong> build.gradle file as below for both buildscripts and 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() } }

Clean up your project and then perform a new Sync.

<ul><li>Try "<strong>File</strong>"->"<strong>Invalidate Caches / Restart ...</strong>"</li> <li>Try to clean up your .gradle and .idea directory under your project root directory.</li> </ul>

See below references:

<ul><li><a href="https://stackoverflow.com/a/51151050/8034839" rel="nofollow">https://stackoverflow.com/a/51151050/8034839</a></li> <li><a href="https://stackoverflow.com/a/51354236/8034839" rel="nofollow">https://stackoverflow.com/a/51354236/8034839</a> </li> </ul><hr />

<strong>For the warnings:</strong>

<blockquote>

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

</blockquote>

Because you are using AGP (<strong>A</strong>ndroid <strong>G</strong>radle <strong>P</strong>lugin 3.2.1), the build configuration compile has changed to implementation and api. Just replace all the compile with implementation or api will let this warning disappear. See: <a href="https://developer.android.com/studio/build/dependencies#dependency_configurations" rel="nofollow">https://developer.android.com/studio/build/dependencies#dependency_configurations</a> for more details.

<blockquote>

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.

</blockquote>

This warning is just for your information, you can simply ignore it or remove buildToolsVersion '25.0.2' from your build.gradle file to suppress this warning.

Recommend

  • port not opening even after adding rule in ufw?
  • 3d object recognition for AR android app
  • Split string and numbers
  • three.js transparent png texture strange border webgl
  • Using gson, how to exclude a numeric type (double, integer) with default value from serialization?
  • Select Checkbox !== Select Row Table
  • ARKit – Rendering a 3D object under an invisible plane
  • Django activity stream filter Actions by foreignkey in target model
  • COM Interop hang freezes entire COM system. How to cancel COM call
  • Eclipse ADT Plugin crashed after updating to version 22.0
  • Is there a function to calculate the difference between two times and display a relative result?
  • Multiple JSliders reacting to each other to always equal 100 percent
  • How do I hide and show the contents contents of a modal?
  • Adding custom message on Thank You page by shipping method
  • Getting specific color for specific value using JSON data
  • can I build CMakeLists.txt from a set of smaller files (to improve the readability and maintainabili
  • Identifying dates in strings using NLTK
  • Thick underline when hover AND when active
  • Send HTML Mail with Unicode
  • VB.NET and LINQ - Group by in a DataTable
  • jQuery colorbox breaks postbacks in ASP.NET Web Forms
  • Getting/building the SQL (with parameters) from NHibernate 3.2
  • How can I do case insensitive string search with Linq and SQL Server?
  • How to create OLE Automation to be used with ClearExplorer
  • Adding horizontal slider to QTableWidget
  • Create an Office365 mailbox from within C# Web API method
  • Set WebClient.Builder.exchangeStrategies() without losing Spring Jackson configuration
  • How convert html to BBcode in C#
  • JQuery: Infinite input select
  • I am consuming a WCF service that requires headers from a .NET 2 website. How can I programmatically
  • How to use FirstOrDefault inside Include
  • Time Complexity of Fibonacci Algorithm [duplicate]