React-Native:无法解析配置':app:debugCompileClasspath'的所有文件

时间:2018-10-23 19:05:42

标签: android react-native

我是本机反应的新手,遵循Getting Started指南,现在我只是在尝试编译我的第一个android应用程序。不幸的是,控制台输出:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-vector-drawable.aar (com.android.support:support-vector-drawable:27.1.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-vector-drawable/27.1.1/support-vector-drawable-27.1.1.aar
> Could not find livedata-core.aar (android.arch.lifecycle:livedata-core:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.aar
> Could not find viewmodel.aar (android.arch.lifecycle:viewmodel:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.aar
> Could not find runtime.aar (android.arch.core:runtime:1.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/android/arch/core/runtime/1.1.0/runtime-1.1.0.aar

我跳过了哪些步骤?我的平台是Windows 10和Android Phone 7.1.1。

1 个答案:

答案 0 :(得分:2)

我解决了,只需添加:

maven { url 'https://maven.google.com' }

至:android / build.gradle

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

我想这是gradle版本的问题