我正在尝试运行默认的 flutter 应用程序,但是当我运行它时会出现以下错误:
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.5.3.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.3.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Connect to 172.30.0.15:3128 [/172.30.0.15] failed: Connection timed out: connect
> Could not resolve com.android.tools.build:gradle:3.5.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Connect to 172.30.0.15:3128 [/172.30.0.15] failed: Connection timed out: connect
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Connect to 172.30.0.15:3128 [/172.30.0.15] failed: Connection timed out: connect
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Connect to 172.30.0.15:3128 [/172.30.0.15] failed: Connection timed out: connect
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 25s
Exception: Gradle task assembleDebug failed with exit code 1
下面是 build.gradle 代码:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
该应用程序的整个代码是默认代码,没有进行任何更改我刚刚连接了一个模拟器并尝试运行它是否有效并且我陷入了这个 assembleDebug 错误。
如果有人知道我哪里出错了,请发表评论...
最佳答案
Flutter 中重要的 CLI 命令之一是 flutter doctor
.该命令将检查 flutter 信息的当前状态。如果某些软件丢失或无法运行,则会显示警告。
查看documentation举个例子(这是为 Windows OS 设置)。
另见 macOS设置,Linux和 Chrome OS .
关于android - flutter : "Could not resolve all artifacts for configuration ':类路径'“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62082849/