Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot build for android using react-native

I'm trying to run react-native run-android but I continuously get this error.I am running on emulator . I started the app using react-native init.

PS: I am running on proxy.

When I am trying to run

react-native run-android

I get:

FAILURE: Build failed with an exception.

*  What went wrong:
 A problem occurred configuring root project 'AwesomeProject'.
 > Could not resolve all dependencies for configuration ':classpath'.
 > Could not resolve com.android.tools.build:gradle:2.2.3.
 Required by:
     :AwesomeProject:unspecified
  > Could not resolve com.android.tools.build:gradle:2.2.3.
     > Could not get resource 'https://jcenter.bintray.com/com/android/tool
/build/gradle/2.2.3/gradle-2.2.3.pom'.
        > Could not GET 'https://jcenter.bintray.com/com/android/tools/buil
 /gradle/2.2.3/gradle-2.2.3.pom'. Received status code 407 from server: 
 Proxy Authentication Required

When I am trying to run

directly in Android Studio

I get:

Error:Could not GET 
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-
2.2.3.pom'. Received status code 407 from server: Proxy Authentication 
 Required
<a href="toggle.offline.mode">Enable Gradle 'offline mode' and sync 
project</a>

I have my node_modules installed and I'm not sure what else to try, I've been googling for the last 4 hours and have come up with nothing.

like image 203
rajat44 Avatar asked Oct 16 '17 13:10

rajat44


Video Answer


2 Answers

set your proxy details Inside sdk manager

AndroidStudio->tools->Android->SDKManager->system settings->Http Proxy

like image 105
Jose Kj Avatar answered Oct 14 '22 12:10

Jose Kj


your problem is not related to npm and node. you have some gradle problems.check if you can access the URL from browser?

https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle- 2.2.3.pom

like image 37
Sinapcs Avatar answered Oct 14 '22 11:10

Sinapcs