This question already has answers here:
Closed 2 years ago.
When run react-native run-android, I got this error :
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-device-info'.
> Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I found this solution and works for me:
add maven { url "https://maven.google.com" }
in line 18 in file android/build.gradle
If you are using jcenter()
and maven {url "https://maven.google.com"}
make sure that maven {url "https://maven.google.com"}
is written first (upper in code).
android.arch.core:common:1.0.0
exists in jcenter()
, but doesn't have .jar
file there and thats why build fails. Using Google Maven first fixes this problem, because .jar exist there.
allprojects {
repositories {
maven { url 'https://maven.google.com' } // <--- This needs to be before jcenter().
jcenter()
}
}
In my case, it was a network issue with my Wifi (proxy...). Try to switch network with mobile data for example.
I updated my root projects build gradle version and all the support libraries to latest version and its working now, you can check it go through, build.gradle(root project) -> buildscript -> dependencies-> classpath->
classpath 'com.android.tools.build:gradle:3.your_latest_version'
also make sure your compileSdkVersion and buildToolsVersion are latest
and once check version of distributionUrl also from gradle-wrapper.properties file