Home > Software engineering >  emulator in vscode
emulator in vscode

Time:12-14

when i try to run my code ( flutter ) in vscode and on an emualtor it gives me this error . i can run my app in web or windows but not in emulator or android studio.

`

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:7.1.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
     Required by:
         project :

* 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 3s
Running Gradle task 'assembleDebug'...                             74.9s
Exception: Gradle task assembleDebug failed with exit code 1

`

i try to run in emulator but have no luck , runs fine in web

CodePudding user response:

It seems, flutter run script can't get some gradle dependencies, you need to try run app with some VPN services, as with this way you may get those dependencies and succesfully build the app.

CodePudding user response:

There is no gradle version 7.1.2 available in gradle release. You can use 7.1.1 or 7.2.

Gradle Release Official Doc : https://gradle.org/releases/

You need to define it in android/gradle/wrapper/gradle-wrapper.properties like this :

distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip
  • Related