简体   繁体   English

由于 Gradle 错误,Flutter 运行无法正常工作。 尝试了所有解决方案,但没有奏效。 gradle 的问题

[英]Flutter run not working due to Gradle error. Tried all the solutions but not working. Problem with gradle

When I run flutter run --no-sound-null safety当我运行flutter run --no-sound-null safety

This shows the output.这显示了 output。 I have tried all the solutions available.我已经尝试了所有可用的解决方案。 But not working.但不工作。 Here is the error这是错误

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:4.1.0.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:4.1.0.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
               > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* 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 37s

My android/build.gradle file我的 android/build.gradle 文件

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

My android/gradle/wrapper/gradle-wrapper.properties file content are:我的 android/gradle/wrapper/gradle-wrapper.properties 文件内容是:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

I don't know how to fix this please help.. I am trying it since 1 day.我不知道如何解决这个问题,请帮忙..我从 1 天开始就在尝试。 All worked fine but suddenly this error came.. Thanks in advance.一切正常,但突然出现这个错误..提前致谢。

Check whether you have your internet on.检查你是否有你的互联网。 Secondly, upgrade ext.kotlin_version in andriod build.其次,在andriod build 中升级ext.kotlin_version。 gradle to 1.5.31 or higher and try to run the app again gradle 到 1.5.31 或更高版本并尝试再次运行应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM