在intellij中运行示例dart应用时发生错误

时间:2019-01-24 19:15:22

标签: android dart flutter

我正在尝试在Intelij IDE中运行我的第一个示例flutter应用程序,但是出现了我无法解决的错误。

我所做的是,在“文件”>“新建”>“项目”中,然后选择flutter,并指定了应用名称,然后单击“确定”。

接下来,在加载界面时,我连接了手机,然后看到它显示在右上角,在旁边选择了main.dart并按下了绿色的播放按钮,但在控制台上却出现了错误。 / p>

Initializing gradle...
Resolving dependencies...
Launching lib/main.dart on CP8676 I02 in profile mode...
Gradle task 'assembleProfile'...

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:3.2.1-4818971.
  Required by:
      project :app
   > Could not resolve com.android.tools.build:aapt2:3.2.1-4818971.
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom'.
            > dl.google.com: Name or service not known
   > Could not resolve com.android.tools.build:aapt2:3.2.1-4818971.
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom'.
         > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.1-4818971/aapt2-3.2.1-4818971.pom'.
            > jcenter.bintray.com: Name or service not known

* 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 30s
Finished with error: Gradle task assembleProfile failed with exit code 

我的build.gradle文件:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

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
}

这是我的build.gradle文件。当我将鼠标悬停在buildscript上时,intellij说,它无法解析符号“ buildscript”,对于其他定义(例如此文件中的存储库)也是如此。

0 个答案:

没有答案