0

I was trying to run an android project with this command:

react-native run-android

but it doesn't build anything and print this msg:

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not download javax.inject.jar (javax.inject:javax.inject:1)
   > Could not get resource 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
      > Could not GET 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
         > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed
t: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log outpu

BUILD FAILED

Total time: 2 mins 17.303 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

how can I fix it?

3
  • why do u need java.inject.jar? remove it and it will solve your problem? Commented Mar 7, 2017 at 9:24
  • I don't know & where is this? Commented Mar 7, 2017 at 9:30
  • You can try ./gradlew clean and then ./gradlew build and turn on your emulator first react-native run-android Commented Mar 7, 2017 at 9:46

1 Answer 1

2

as you can see, you need to run your android simulator first or connect to a device.

so in your terminal type:

android avd

then create a device if you dont have one, then start it. If the simulator has run, then you can start building by typing

react-native run-android
Sign up to request clarification or add additional context in comments.

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.