React-native android build failed with an exception - android

I followed every single step in the react native documentation to set up a project with create-react-native.
react-native init MobileProject
cd MobileProject && react-native run-android
However, it seems like the build won't fetch resources online. I tried to change proxy, swapped repositories in build.gradle but nothing seems to work. Any help would be greatly appreciated!
What went wrong:
A problem occurred configuring root project 'MobileProject'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.4.2.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.4.2.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom'.
jcenter.bintray.com:443 failed to respond
Could not resolve com.android.tools.build:gradle:3.4.2.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom'.
dl.google.com:443 failed to respond

Related

Could not determine the dependencies of task ':app:preReleaseBuild'

I'm trying to create project to .apk file but got this error when I type - ./gradlew bundleRelease:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preReleaseBuild'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
> Could not resolve project :react-native-gesture-handler.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-gesture-handler: None of the consumable configurations have attributes.
I know there are some questions like mine but none is exact the same. I'm sorry if there is already existing solution, but I didn't found.
You may not link the library react-native-gesture-handler

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'

when I run react-native run-android on my windows10 these errors appear. I was able to run this app before and it used to work just fine. I've been digging the internet for a solution for a few days now but I wasn't able to fix it. can anyone help me please? I would be really appreciated.
my system specifications:
windows 10
react-native-cli: 2.0.1
react-native: 0.57.1 (I also tested 0.57.2 & 0.55.4)
babel: 4.6.1
gradle: 4.9
...............................error:
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve project :react-native-bluetooth-serial.
Required by:
project :app
Unable to find a matching configuration of project :react-native-bluetooth-serial: None of the consumable configurations have attributes.
Could not resolve project :react-native-ble-plx.
Required by:
project :app
Unable to find a matching configuration of project :react-native-ble-plx: None of the consumable configurations have attributes.

react-native-git-upgrade not working

I just tried to run react-native-git-upgrade by following the documentation here. After running the upgrade, I then tried to start my project using react-native run-android but got the following errors (see below).
I also tried to follow the "Alternative" way of upgrading from that documentation but eventually ended up with the same error shown below.
How should I proceed to get the upgrade working properly?
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not resolve com.facebook.fresco:fresco:1.0.1.
Required by:
OrderEntry:app:unspecified > com.facebook.react:react-native:0.43.3
> Could not resolve com.facebook.fresco:fresco:1.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/facebook/fresco/fresco/1.0.1/fresco-1.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/facebook/fresco/fresco/1.0.1/fresco-1.0.1.pom'.
> jcenter.bintray.com
> Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.0.1.
Required by:
OrderEntry:app:unspecified > com.facebook.react:react-native:0.43.3
> Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.0.1/imagepipeline-okhttp3-1.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.0.1/imagepipeline-okhttp3-1.0.1.pom'.
> jcenter.bintray.com
I was finally able to resolve this. It turned out to be an issue with gradle not being able to access the google repositories due to proxy issues. To resolve it, I added a gradle.properties file to my C:\Users\my_user_id>\.gradle folder with the following values:
systemProp.http.proxyHost=your_proxy.com
systemProp.http.proxyPort=80
systemProp.https.proxyHost=your_proxy.com
systemProp.https.proxyPort=80
Once I added that file, I actually ran into more problems which you can read about here, but I finally got things running.
I am not sure why the project ran ok on the previous react-native version without needing the gradle.properties file. Anyway, hope this helps if anyone has the same problem.

Sync failed - Could not find com.google.android.gms:play-services:9.4.0

I tried to run a project which was generated on someone else's PC, but sync fails and I get this error when cleaning the project:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.google.android.gms:play-services:9.4.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.jar
file:/C:/Users/win7/AppData/Local/Android/sdk1/extras/android/m2repository/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.pom
file:/C:/Users/win7/AppData/Local/Android/sdk1/extras/android/m2repository/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.jar
file:/C:/Users/win7/AppData/Local/Android/sdk1/extras/google/m2repository/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.pom
file:/C:/Users/win7/AppData/Local/Android/sdk1/extras/google/m2repository/com/google/android/gms/play-services/9.4.0/play-services-9.4.0.jar
Required by:
Map:app:unspecified
was generated on someone other's PC on mine
They probably have the SDK repositories installed and you do not.
Seems like you are missing the Google Play Services Repository.

React Native: Could not resolve all dependencies for configuration

I just started with React native.
I've follow this article: https://facebook.github.io/react-native/docs/getting-started.html
I run my application with command: react-native run-android but it show an exception:
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project
Could not resolve all dependencies for co
Could not resolve com.android.tools.bu
Required by:
:abcdefgg:unspecified
Could not resolve com.android.tools
Could not get resource 'https:// /build/gradle/1.3.1/gradle-1.3.1.pom'.
Could not GET 'https://jcente /gradle/1.3.1/gradle-1.3.1.pom'.
Connection to https://jcen
Try: Run with --stacktrace option to get the sta option to get more log output.
BUILD FAILED
How can i resolve this problem? I've read many articles here, Local Maven repository for Support Library has been installed in my computer.
Thanks very much!
I just solve this problem this morning.
If you noticed there is a list of dependencies map defined in settings.gradle inside android folder.
Here is what I did:
Go to android folder
Run this command ./gradlew installDebug --info
And then it will show a list of dependencies that android need. It also show which dependencies are not resolved.
In my case I'm lack of 'react-native-network-info' so all I need to do is npm install that package.
Maybe your situation will difference but I think this can help you.
In react-native this problem is due to flipper dependencies, it is solved by increasing its version to 0.105.0. (file: gradle.properties)

Categories

Resources