7

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.

3
  • You have a Proxy Authentication Commented Oct 16, 2017 at 20:08
  • for android studio check this stackoverflow.com/questions/26916951/… Commented Oct 17, 2017 at 3:26
  • The problem is actually quite simple; Your computer can't retrieve the server that has the gradle build tools (no matter you if you use Studio or React Native to compile). Simply using a VPN, or a different internet connection should resolve your issue. Commented Oct 30, 2017 at 17:09

4 Answers 4

3

set your proxy details Inside sdk manager

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

Sign up to request clarification or add additional context in comments.

3 Comments

please check connection as mentioned here stackoverflow.com/a/26919995/5706413
I did auto detect proxy settings.
connection successful
2

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

1 Comment

Yes, I can access the link. Now can you please tell me what can be the problem and how to correct it ?
2
+25

It clearly says <a href="toggle.offline.mode">Enable Gradle 'offline mode' and sync project</a>. Have you tried enabling offline mode? If not, try this:

Go to File -> Settings.

And open the 'Build,Execution,Deployment',Then open the 'Build Tools' -> 'Gradle'.

Then uncheck "Offline work" on the right.

Click the 'OK' button.

Then Rebuild the Project.

For Mac go to AndroidStudio -> Preferences, rest is same.

ref.: https://stackoverflow.com/a/30794890/2895571

Comments

2

Try adding these in your gradle.properties:

systemProp.http.proxyHost=proxyURL
systemProp.http.proxyPort=proxyPort
systemProp.http.proxyUser=USER
systemProp.http.proxyPassword=PASSWORD
systemProp.https.proxyHost=proxyUrl 
systemProp.https.proxyPort=proxyPort
systemProp.https.proxyUser=USER
systemProp.https.proxyPassword=PASSWORD

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.