[英]Build failed on run-android due to dependencies
Problem while running the run-android. 运行run-android时出现问题。 I was facing a problem, I guess it's dude to the gradle dependencies.
我遇到了一个问题,我猜这是对gradle依赖的问题。
I have even tried sudo, which is giving some other random error saying $ANDROID_HOME. 我甚至尝试过sudo,它给出了一些其他的随机错误说$ 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? 我哪里做错了?
Android Support Repository was missing installed, again followed all the steps here: https://facebook.github.io/react-native/docs/android-setup.html 安装缺少Android支持存储库,再次按照此处的所有步骤操作: https : //facebook.github.io/react-native/docs/android-setup.html
https://github.com/facebook/react-native/issues/2772#issuecomment-140843907 https://github.com/facebook/react-native/issues/2772#issuecomment-140843907
In case, like me, nothing else you've read has worked, this worked for me: 如果像我一样,你读过的其他内容都没有用,这对我有用:
npm cache clean && npm install
watchman watch-del-all
react-native start -- --reset-cache
react-native run-android
:mind-blown: :心灵成熟:
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
下载支持库/ appcompat的新版本,然后重试
It looks like you don't have android sdk installed and/or the path to it is not set up properly. 看起来你没有安装android sdk和/或它的路径设置不正确。 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 .
有关如何在反应原生的android安装文档中执行此操作的详细说明,请按照安装和配置SDK的说明进行操作。
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 (eg sudo ./tools/android
) to get around this error. 对于那些在尝试使用
Android SDK Manager
( tools/android
)时遇到此问题的人,我必须以root身份运行SDK管理器(例如sudo ./tools/android
)来解决此错误。
Unfortunately, running an X11-forwarded program as root can sometimes bring about its own issues. 不幸的是,以root身份运行X11转发的程序有时会带来自己的问题。 If you encounter problems trying to run the SDK manager as root, see this answer here .
如果您在尝试以root身份运行SDK管理器时遇到问题,请在此处查看此答案 。 Specifically, I was able to run the SDK manager as my normal user, but attempting to run as root always failed.
具体来说,我能够以普通用户身份运行SDK管理器,但尝试以root身份运行总是失败。
It looks like you don't have android sdk installed and/or the path to it is not set up properly. 看起来你没有安装android sdk和/或它的路径设置不正确。 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.
有关如何在反应原生的android安装文档中执行此操作的详细说明,请按照安装和配置SDK的说明进行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.