iraycd
iraycd

Reputation: 892

Build failed on run-android due to dependencies

Problem while running the run-android. I was facing a problem, I guess it's dude to the gradle dependencies.

I have even tried sudo, which is giving some other random error saying $ANDROID_HOME. Which isn't the problem.

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:appcompat-v7:23.0.0.
     Searched in the following locations:
         file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
         file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
         https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
         https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
     Required by:
         AwesomeProject:app:unspecified
   > Could not find com.android.support:appcompat-v7:23.0.0.
     Searched in the following locations:
         file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
         file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
         https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
         https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
     Required by:
         AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0
   > Could not find com.android.support:support-v4:21.0.3.
     Searched in the following locations:
         file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
         file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
         https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
         https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
     Required by:
         AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
         AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1

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

BUILD FAILED

Total time: 11.247 secs
Could not install the app on the device, see the error above.

Where did I go wrong?

Upvotes: 15

Views: 16942

Answers (6)

user10673998
user10673998

Reputation: 1

It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.

Upvotes: -1

codenamev
codenamev

Reputation: 2208

In case, like me, nothing else you've read has worked, this worked for me:

  1. Check in the latest snapshot of changes to your source control
  2. Remove the project directory from your system
  3. Check out your code from source control
  4. npm cache clean && npm install
  5. watchman watch-del-all
  6. react-native start -- --reset-cache
  7. react-native run-android

:mind-blown:

Upvotes: 3

scottysseus
scottysseus

Reputation: 2020

For those encountering this problem when they attempt to simply use the Android SDK Manager (tools/android), I had to run the SDK manager as root (e.g. sudo ./tools/android) to get around this error.

Unfortunately, running an X11-forwarded program as root can sometimes bring about its own issues. If you encounter problems trying to run the SDK manager as root, see this answer here. Specifically, I was able to run the SDK manager as my normal user, but attempting to run as root always failed.

Upvotes: 0

iraycd
iraycd

Reputation: 892

Android Support Repository was missing installed, again followed all the steps here: https://facebook.github.io/react-native/docs/android-setup.html

https://github.com/facebook/react-native/issues/2772#issuecomment-140843907

Upvotes: 13

Andrei Ovidiu Coman
Andrei Ovidiu Coman

Reputation: 201

It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.

Upvotes: 1

Chris Thoma
Chris Thoma

Reputation: 499

Doesn't look like you've updated your libs on your machine to the newest version. Download the new versions of the support library/appcompat and then try again

Upvotes: 1

Related Questions