Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Error while building react native app: Could not resolve all artefacts for configuration react-native-get-real-path #24

Open
hackothaurus opened this issue May 11, 2022 · 2 comments

Comments

@hackothaurus
Copy link

Environment

React native version: 0.62.2,
react-native-get-real-path: "git+https://github.com/Wraptime/react-native-get-real-path.git",
Gradle version 3.3.0,
Dependency in react-native-get-real-path's build.gradle file: Gradle version 2.2.+

Description

I try to run the app with react-native run-android or if I run ./gradlew clean in the android folder, I get the error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-get-real-path'.

Could not resolve all artifacts for configuration ':react-native-get-real-path:classpath'.
Could not resolve com.android.tools.build:gradle:2.2.+.
Required by:
project :react-native-get-real-path
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)

I didn't change anything in the project and it was working fine a while ago.
I've deleted and reinstalled node modules, cleared caches, ran it on another android environment, but I keep getting this error.
I also added google() as the repositories in react-native-get-real-path's build.gradle file, all to no avail.

Reproducible Demo

Building the project with the mentioned RN, Gradle and react-native-get-real-path versions.

@hackothaurus
Copy link
Author

As far as my understanding goes, jcentre() doesn't support Gradle version 2.2.+ anymore.

A solution that's worked for me:

  1. Adding mavenCentral() to the repositories under allprojects in the project level build.gradle file.
  2. Adding mavenCentral() in the repositories in react-native-get-real-path's build.gradle file
  3. As react-native-get-real-path was a dependency in my case for react-native-firebase, I also had to add maven central as a dependency in that module's build.gradle file for it to work.

Hope this helps.

@lalcaraz
Copy link

lalcaraz commented May 16, 2022

image-20220516-142609
Solved by forking and changing build.gradle file as shown.

Edit: jcentre URL is being shut down. https://www.infoq.com/news/2021/02/jfrog-jcenter-bintray-closure/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants