【问题标题】:react-native - unable to run sample appreact-native - 无法运行示例应用程序
【发布时间】:2017-03-06 18:21:22
【问题描述】:

按照教程here,我无法在模拟器中运行该应用程序。当我在 DOS 提示符下执行 react-native run-android 命令时,出现以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:2.2.3.
     Required by:
         :AwesomeProject:unspecified
      > Could not resolve com.android.tools.build:gradle:2.2.3.
         > Could not get resource 'https://repo1.maven.org/maven2/com/android/to
ols/build/gradle/2.2.3/gradle-2.2.3.pom'.
            > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/2.2.3/gradle-2.2.3.pom'.
               > repo1.maven.org
      > Could not resolve com.android.tools.build:gradle:2.2.3.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/2.2.3/gradle-2.2.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/2.2.3/gradle-2.2.3.pom'.
               > jcenter.bintray.com

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

我尝试过的事情:

  1. 编辑 build.gradle 文件并将类路径从类路径 'com.android.tools.build:gradle:2.2.3' 更改为 com.android.tools.build:gradle:3.3.0'(我安装的版本) Android Studio)。
  2. 已验证 jcenter() 在 build.gradle 中的 buildscript 和 allprojects 下都列为存储库

【问题讨论】:

    标签: react-native


    【解决方案1】:

    尝试将其设置为 2.3.0

    奇怪,我在该路径中看不到任何 2.2.3,但我可以看到 2.3.0 http://repo1.maven.org/maven2/com/android/tools/build/gradle/

    【讨论】:

      【解决方案2】:

      我使用 react-native cli 重新创建了项目,问题似乎自行解决了。我应该注意,我相信我最初创建项目时没有安装 android studio,所以可能与它有关,不确定。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-06-17
        • 1970-01-01
        • 1970-01-01
        • 2016-07-12
        • 1970-01-01
        • 2018-04-24
        • 1970-01-01
        相关资源
        最近更新 更多