【发布时间】:2019-05-18 17:44:43
【问题描述】:
您好,我正在尝试在 react native 中运行应用程序,但是在加载依赖项时,即 com.android.tools.build:gradle:3.1.4。我收到一条错误消息:
FAILURE:构建失败并出现异常。
-
出了什么问题: 配置根项目“新”时出现问题。
无法解析配置“:classpath”的所有文件。 无法解析 com.android.tools.build:gradle:3.1.4。 要求: 项目 : 无法解析 com.android.tools.build:gradle:3.1.4。 无法获取资源“https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom”。 无法获取“https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom”。 连接到 192.168.0.1:8080 [/192.168.0.1] 失败:连接超时:连接 无法解析 com.android.tools.build:gradle:3.1.4。 无法获取资源“https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom”。 无法获取“https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom”。 连接到 192.168.0.1:8080 [/192.168.0.1] 失败:连接超时:连接
尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
我的 build.gradle 类已配置为大多数解决方案提供的内容
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// 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"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
但我仍然无法找到加载 com.android.tools.build:gradle:3.1.4 的解决方案。 我不知道错误是否源于 连接到 192.168.0.1:8080 [/192.168.0.1] 失败:连接超时:连接部分。 任何有解决方案的人请帮忙。
【问题讨论】:
标签: android node.js react-native