由于依赖性,在run-android上构建失败

时间:2015-09-16 19:09:50

标签: android react-native

运行run-android时出现问题。我遇到了一个问题,我想这对于gradle依赖是个坏事。

我甚至尝试过sudo,它提出了一些其他随机错误说$ ANDROID_HOME。这不是问题。

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.

我哪里出错了?

6 个答案:

答案 0 :(得分:13)

答案 1 :(得分:3)

如果像我一样,你读过的其他内容都没有用,这对我有用:

  1. 检查源控件更改的最新快照
  2. 从系统中删除项目目录
  3. 从源代码管理中查看您的代码
  4. npm cache clean && npm install
  5. watchman watch-del-all
  6. react-native start -- --reset-cache
  7. react-native run-android
  8. :令人惊叹:

答案 2 :(得分:1)

看起来您没有将计算机上的库更新到最新版本。下载支持库/ appcompat的新版本,然后重试

答案 3 :(得分:1)

看起来你没有安装android sdk和/或没有正确设置它的路径。有关如何在反应原生的android设置文档中执行此操作的详细说明,请按照Install and configure SDK的说明进行操作。

答案 4 :(得分:0)

对于那些在尝试使用Android SDK Managertools/android)时遇到此问题的人,我必须以root用户身份运行SDK管理器(例如sudo ./tools/android)以解决此错误。

不幸的是,以root身份运行X11转发的程序有时会带来自己的问题。如果您在尝试以root身份运行SDK管理器时遇到问题,请参阅this answer here。具体来说,我能够以普通用户身份运行SDK管理器,但尝试以root身份运行总是失败。

答案 5 :(得分:-1)

您似乎没有安装android sdk和/或未正确设置它的路径。 react native的android设置文档中有关于如何执行此操作的详细说明,请按照有关安装和配置SDK的说明进行操作。