3

I am getting this error when I want to run my flutter app. I am using flutter 1.0.0 version and android studio 3.2.1 version.

My emulator is Pixel 2 android 8.1.

I have also used android 9 but it did not work either.

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "E:\TUT\flutter\project\myfirstapp\android\gradlew.bat" exited abnormally:

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.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > jcenter.bintray.com
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > dl.google.com

* 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 27s
  Command: E:\TUT\flutter\project\myfirstapp\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.
3
  • If you run “flutter doctor” from cli the output show it’s all right or you have some error/warnings? Commented Dec 15, 2018 at 0:53
  • no it shows no errors or warning Commented Dec 15, 2018 at 7:17
  • So use @martin-zeitler answer. Commented Dec 15, 2018 at 8:08

4 Answers 4

3

you need to add repository google() to the buildscript dependencies of the root project.

the file might be E:\TUT\flutter\project\myfirstapp\android\build.gradle

right next to the jcenter() repository; which does not serve this dependency.

Sign up to request clarification or add additional context in comments.

Comments

3

I was getting the same error until I ran it with internet connection,seemingly it downloaded necessary resources.

Comments

1

If the project Gradle version didn't install on your machine, flutter try to download the appropriate version from google server before compile.

So

  1. Ensure your computer is connected to the Internet.
  2. Google restricted access to some of its services in certain countries, such as Iran, Cuba, Sudan, Syria and etc. Therefore, Make sure your system has access to google developer subdomains. (use VPN in restricted countries)
  3. Or Change the project Gradel version on "android\build.gradle -> dependencies" with the installed version number

Comments

1

enter image description here

As shown in the picture above, you should check the plugin version and required gradle version.

For checking plugin version :android-->build.gardle-->build scripts-->dependencies-->calsspath
For cheking required gardle version :android-->gradle-->wrappper-->gradle-wrapper.properties

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.