android - flutter : "Could not resolve all artifacts for configuration ':类路径'“

标签 android flutter kotlin gradle

我正在尝试运行默认的 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设置,LinuxChrome OS .

关于android - flutter : "Could not resolve all artifacts for configuration ':类路径'“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62082849/

相关文章:

java - 如何使 EditText 获得您长按的 ArrayList 元素的值?

Android C2DM 和 lib 项目

java - 如何在Android中查找单个乐器的和弦

android - 无法访问某些手机数据/数据中的本地文件

android - 如何确定 kotlin-multiplatform 项目中的构建类型

android - 正则表达式删除除句点外的所有特殊字符

Android 如何在 Activity 中的任何地方滑动时调用 OnFling 而不仅仅是在 ViewFlipper 中

Flutter web - 服务器响应状态为 404(未找到),main.dart.js :1

dart - 无效的版本约束 : Cannot include other constraints with "^"

kotlin - Kotlin:仅允许泛型使用同一类的参数