我已经按照 Mac OS X 上的 react-native android 设置指南进行操作。我已经运行了模拟器。当我运行 react-native run-android 时,我得到以下信息:
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 any matches for com.android.support:appcompat-v7:23.0.+ as no versions of com.android.support:appcompat-v7 are available.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/maven-metadata.xml
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/
https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/appcompat-v7/
Required by:
fuckoff:app:unspecified
> Could not find com.android.support:appcompat-v7:22.2.0.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
Required by:
fuckoff: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/hugo/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/hugo/.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:
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
我安装了所有必需的 Android SDK 包,包括构建工具和支持存储库。我注意到它正在寻找我家中名为 .m2
的目录,但该目录不存在。我从来不需要 Maven 来进行 android 开发。我需要安装它才能使用 react-native 吗?
最佳答案
为了绝对安全,我尝试使用 android update sdk --no-ui
更新 android 包。
显然我使用 android
安装的软件不是最新的。运行更新解决了这个问题。
关于android - React Native run-android 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32828906/