运行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.
我哪里出错了?
答案 0 :(得分:13)
安装了Android支持存储库,再次按照此处的所有步骤进行操作:https://facebook.github.io/react-native/docs/android-setup.html
https://github.com/facebook/react-native/issues/2772#issuecomment-140843907
答案 1 :(得分:3)
如果像我一样,你读过的其他内容都没有用,这对我有用:
npm cache clean && npm install
watchman watch-del-all
react-native start -- --reset-cache
react-native run-android
:令人惊叹:
答案 2 :(得分:1)
看起来您没有将计算机上的库更新到最新版本。下载支持库/ appcompat的新版本,然后重试
答案 3 :(得分:1)
看起来你没有安装android sdk和/或没有正确设置它的路径。有关如何在反应原生的android设置文档中执行此操作的详细说明,请按照Install and configure SDK的说明进行操作。
答案 4 :(得分:0)
对于那些在尝试使用Android SDK Manager
(tools/android
)时遇到此问题的人,我必须以root用户身份运行SDK管理器(例如sudo ./tools/android
)以解决此错误。
不幸的是,以root身份运行X11转发的程序有时会带来自己的问题。如果您在尝试以root身份运行SDK管理器时遇到问题,请参阅this answer here。具体来说,我能够以普通用户身份运行SDK管理器,但尝试以root身份运行总是失败。
答案 5 :(得分:-1)
您似乎没有安装android sdk和/或未正确设置它的路径。 react native的android设置文档中有关于如何执行此操作的详细说明,请按照有关安装和配置SDK的说明进行操作。