0

I am trying to run my first sample flutter app in Intelij IDE, but I get an error which I am unable to resolve.

What I did was, File > New > Project, then I chose flutter, and gave the app name, and clicked Ok.

Next when the interface loaded, I connected my phone and then I saw it displayed in the top right corner, and beside it I selected main.dart and pressed the green play button, but int the console I got an error.

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 

My build.gradle file:

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
}

Here is my build.gradle file.I see that when I hover over the buildscript, intellij says, cannot resolve symbol 'buildscript', the same occours for other definitions such as repositories in this file.

Sammy J
  • 1,048
  • 10
  • 28

0 Answers0