【问题标题】:react-native can't build run android correctlyreact-native 无法正确构建运行 android
【发布时间】:2017-03-07 09:17:09
【问题描述】:

我试图用这个命令运行一个 android 项目:

react-native run-android

但它没有构建任何东西并打印此消息:

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not download javax.inject.jar (javax.inject:javax.inject:1)
   > Could not get resource 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
      > Could not GET 'https://jcenter.bintray.com/javax/inject/javax.inject/1/javax.inject-1.jar'.
         > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed
t: connect

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

BUILD FAILED

Total time: 2 mins 17.303 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

我该如何解决?

【问题讨论】:

  • 为什么需要 java.inject.jar?删除它,它会解决你的问题?
  • 我不知道这是哪里?
  • 你可以试试./gradlew clean 然后./gradlew build 并先打开你的模拟器react-native run-android

标签: android android-studio react-native android-gradle-plugin


【解决方案1】:

如您所见,您需要先运行 android 模拟器或连接到设备。

所以在你的终端 类型:

android avd

如果您没有设备,则创建一个设备,然后启动它。 如果模拟器已经运行,那么您可以通过键入开始构建

react-native run-android

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-02
    • 1970-01-01
    • 2021-02-23
    • 2019-01-14
    • 1970-01-01
    • 2019-11-25
    • 1970-01-01
    相关资源
    最近更新 更多