我创建了一个原型react-native应用程序,然后尝试添加react-navigation。然而,当我为“react-native-safe-area-context”添加依赖项时:“^4.2.5”,我开始在我的构建中出现以下错误:
yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1379 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-safe-area-context
[Fatal Error] semver4j-0.16.4.pom:2:1: Content is not allowed in prolog.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-safe-area-context'.
> Could not resolve all artifacts for configuration ':react-native-safe-area-context:classpath'.
> Could not resolve com.github.gundy:semver4j:0.16.4.
Required by:
project :react-native-safe-area-context > org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10
> Could not resolve com.github.gundy:semver4j:0.16.4.
> Could not parse POM https://repo.maven.apache.org/maven2/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4.pom
> Content is not allowed in prolog.
我不确定到底是什么导致了这个问题,因为我仍然使用的主要是标准样板代码。我的build.gradle看起来像下面:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://www.jitpack.io' }
}
}
2条答案
按热度按时间tktrz96b1#
奇怪!但这是我的互联网连接问题
cu6pst1q2#
是的,问题出在网络连接上。