【问题标题】:Flutter: "Could not resolve all artifacts for configuration ':classpath'"Flutter:“无法解析配置':classpath'的所有工件”
【发布时间】:2023-03-17 09:51:01
【问题描述】:

我正在尝试运行默认的颤振应用程序,但是当我运行它时出现以下错误:

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
}

应用程序的整个代码是默认代码,没有进行任何更改我刚刚连接了一个模拟器并尝试运行它是否可以运行,但我遇到了这个 assemble Debug 错误。 如果有人知道我哪里出错了,请发表评论...

【问题讨论】:

  • 检查flutter安装运行flutter doctor
  • 是的,谢谢你知道sdk安装有问题
  • 运行flutter doctor -v 时的输出是什么?你能分享一下吗?既然你发现sdk安装有问题,那是什么?是否涉及 Android SDK 版本对 Flutter 的兼容性问题?

标签: android flutter kotlin gradle


【解决方案1】:

Flutter 中一个重要的 CLI 命令是flutter doctor。该命令将检查颤振信息的当前状态。如果某些软件丢失或无法运行,则会显示警告。

查看documentation 的示例(这是Windows OS 设置)。

另请参阅macOS 设置、LinuxChrome OS

【讨论】:

    猜你喜欢
    • 2021-06-23
    • 1970-01-01
    • 2021-06-04
    • 2021-07-28
    • 2020-04-16
    • 2020-01-31
    • 2021-11-01
    • 2022-09-29
    • 1970-01-01
    相关资源
    最近更新 更多