'Running Flutter app first time Gradle task assembleDebug failed

I’m trying to set up a Flutter project on VSCode, a HelloWorld app, I have fallowed all the steps recommended… But, when I try to run the app, the fallowing error is raised:

Launching lib\main.dart on LG K120 in debug mode... 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://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. Received status code 403 from server: Forbidden 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://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'. Received status code 403 from server: Forbidden

  • 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 1m 12s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

It seems that I don’t have permission to access the resources needed in order to run the app (I have tried to open the links directly in the browser and got the same error:

Forbidden Your client does not have permission to get URL / from this server).

I tried with a VPN (PSiphon) but it keeps raising the error. How can I overcome this problem? Any suggestions?

Thanks in advance



Solution 1:[1]

Open project in Android studio

And do two things

  1. Invalidate caches/restart
  2. Sync project with gradle files

and then try to run the app

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ashutosh singh