Getting "Error running Gradle" in step "resolving dependancies" when I try to execute a flutter project - flutter

I suspect the proxy setting is not set correctly, or I might be wrong, please help me out here. I'm working under a corporate network and using a VPN.
Error details below:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\flutter_workspace\flutter_app\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
Finished with error: Please review your Gradle project setup in the android/ folder.
* 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://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'.
> Connect to dl.google.com:443 [dl.google.com/172.217.9.14] failed: Connection refused: connect
* 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 17s
Command: D:\flutter_workspace\flutter_app\android\gradlew.bat app:properties

Finally finally figured out what I was missing, I had to set the Proxy in gradle.properties file as directed in developers.android.com. For some reason, setting up the proxy in Android Studio alone didn't work.
Updated gradle.properties file:
org.gradle.jvmargs=-Xmx1536M
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=80
PS: Thanks #Taio for your efforts. I appreciate them

Check your internet connection and make sure it is stable. Gradle is trying to connect to the internet to get resources and is unable to.
In this case I would suggest turning off the vpn and waiting for the build process to go on with a normal internet connection then after build you can continue using the vpn

Related

Flutter app doesn't run FAILURE: Build failed with an exception

So I installed flutter and I initialized an app I run the app it
say's
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where: Build file 'C:\src\projects\myapp\android\app\build.gradle' line: 26
What went wrong: A problem occurred evaluating project ':app'.
Could not open dsl generic class cache for script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle'
(C:\Users\admin.gradle\caches\7.5\scripts\6retkvb9i1tmrre8676t631o1).
Unexpected lock protocol found in lock file. Expected 3, found 0.
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 5s Exception: Gradle task assembleDebug failed with
exit code 1
so I checked if I have problem with installation with flutter doctor and it
show's this
I already have system image and when I run the program it always shows the error
and the app doesn't run I already tried setting the JAVA_HOME and copying the jbr files to
jre but still get the error. Thank you for your response
you can visit these two post to solve your problem :
1- first error : Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. Flutter 2.0
2-for second error : Visual Studio not installed; this is necessary for Windows development

Gradle Version in VSCode running Flutter app

I've install the VSCode, Android Studio, and Flutter in my windows. when I try to launch the android emulator (Pixel 4 API TiramisuPrivacySandbox) and Run the app ( default test app generated in VSCode - click counter) I get an error:
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 31s
Exception: Gradle task assembleDebug failed with exit code 1
** in gradle-wrapper.properties file, the gradle version is 7.4
> distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
** in build.gradle file, the gradle version is 7.1.2
> dependencies {
> classpath 'com.android.tools.build:gradle:7.1.2'
> classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
> }`
** in web or windows devices, it runs without error.
Internet Issue ,Check your Internet Connection
if your internet is ok still having this issue then you need to change the internet connection (can use VPN) and try again hope it will work

hello im try to run my flutter app on my real android phone but give me a lot of errors

Launching lib\main.dart on STK L21 in debug mode...
Running Gradle task 'assembleDebug'...
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 5s
Exception: Gradle task assembleDebug failed with exit code 1
How to Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error?
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level.
Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level
please follow this link :https://fluttercorner.com/flutter-problems-could-not-resolve-all-artifacts-for-configuration-classpath/
First You run Flutter Doctor

Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'

App was working completely fine but suddenly it is invoking the following issue.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':google_sign_in:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'.
> Could not resolve project :google_sign_in_web.
Required by:
project :google_sign_in
> Unable to find a matching configuration of project :google_sign_in_web:
- None of the consumable configurations have attributes.
* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
I have imported the latest google_sign_in package in pubspec.yaml but still facing the same build failed error. Any help please!
Solved it by running following command in flutter terminal:
flutter pub cache repair
All of the packages were downloaded and re-installed again.

Could not resolve all artifacts for configuration ':app:debugCompileClasspath'

After the flutter 1.17 update, I tried to run my app, but it shows this error. flutter doctor command works fine. I don't understand what is happening
Launching lib\main.dart on Redmi Note 7 Pro in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not download arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-540786dd51f112885a89792d678296b95e6622e5)
> Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/arm64_v8a_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
> Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-540786dd51f112885a89792d678296b95e6622e5/arm64_v8a_debug-1.0.0-540786dd51f112885a89792d678296b95e6622e5.jar'.
> Remote host closed connection during handshake
* 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 12s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I met with a similar problem of unavailability of kotlin sdk resources. Couldn't find a quick solution, but the problem was most likely on the server side with resources. Because the next morning, the whole assembly was successful.
Perhaps you should just wait, if before that everything was going fine and suddenly stopped.
After reading the entire branch, I still did not find a solution for my case, but it may be useful to someone.
https://github.com/flutter/flutter/issues/23553
I had a similar issue and it was resolved when I changed the following settings in my build.gradle file:
ext.kotlin_version = '1.3.61' //from 1.3.50
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3' //from 3.5.0
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}