React native 无法运行android,因为无法分析POMhttps://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.1/runtime-1.1.1.pom

React native 无法运行android,因为无法分析POMhttps://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.1/runtime-1.1.1.pom,react-native,build.gradle,maven-2,React Native,Build.gradle,Maven 2,我刚刚使用react native init-project name-下载了一个新项目,但我无法在我的模拟器中运行它(react native run android) 它在命令提示符中显示: info JS server already running. info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)... > Task :a

我刚刚使用react native init-project name-下载了一个新项目,但我无法在我的模拟器中运行它(react native run android)

它在命令提示符中显示:

info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...

> Task :app:preDebugBuild
[Fatal Error] runtime-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] runtime-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] common-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] common-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] runtime-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] runtime-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] common-1.1.1.pom:2:1: Content is not allowed in prolog.
[Fatal Error] common-1.1.1.pom:2:1: Content is not allowed in prolog.

> Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve android.arch.lifecycle:runtime:1.1.1.
  Required by:
      project :app > com.android.support:support-compat:28.0.0
   > Could not resolve android.arch.lifecycle:runtime:1.1.1.
      > Could not parse POM https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.1/runtime-1.1.1.pom
         > Content is not allowed in prolog.
> Could not resolve android.arch.core:runtime:1.1.1.
  Required by:
      project :app > android.arch.lifecycle:livedata:1.1.1
      project :app > android.arch.lifecycle:livedata-core:1.1.1
   > Could not resolve android.arch.core:runtime:1.1.1.
      > Could not parse POM https://dl.google.com/dl/android/maven2/android/arch/core/runtime/1.1.1/runtime-1.1.1.pom
         > Content is not allowed in prolog.
> Could not resolve android.arch.core:common:1.1.1.
  Required by:
      project :app > android.arch.lifecycle:livedata:1.1.1
      project :app > android.arch.lifecycle:livedata-core:1.1.1
   > Could not resolve android.arch.core:common:1.1.1.
      > Could not parse POM https://dl.google.com/dl/android/maven2/android/arch/core/common/1.1.1/common-1.1.1.pom
         > Content is not allowed in prolog.
> Could not resolve android.arch.lifecycle:common:1.1.1.
  Required by:
      project :app > android.arch.lifecycle:livedata-core:1.1.1
   > Could not resolve android.arch.lifecycle:common:1.1.1.
      > Could not parse POM https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.1.1/common-1.1.1.pom
         > Content is not allowed in prolog.
我已尝试更改我的build:gradle版本3.0.1,这将是另一个错误,因此我认为我需要升级我的build gradle或降低我的react本机版本。现在我正在尝试从android studio更新我的android sdk

这是我现在的版本gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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


如果我想更新我的构建梯度,我会错过什么?

谷歌回购的回购url看起来是错误的。当前url以
https://maven.google.com/
-看起来您使用的是旧的过时url。我最终修复了它,删除了我的gradle缓存和为gradle隐藏的其他文件,然后再次下载它们。感谢谷歌回购的回购url看起来是错误的。当前url以
https://maven.google.com/
-看起来您使用的是旧的过时url。我最终修复了它,删除了我的gradle缓存和为gradle隐藏的其他文件,然后再次下载它们。谢谢