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

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"
}

Related

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

Flutter Exception: Gradle task assembleDebug failed with exit code 1. when hotspot is on

An error appears when I run my flutter app with hotspot on:
FAILURE: Build failed with an exception.
* What went wrong:
The first result from the daemon was empty. Most likely the process died immediately
after connection.
* 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
Exception: Gradle task assembleDebug failed with exit code 1
I need the hotspot because I want to run the app on physical device using pair wifi to connect to the same wireless network.
What's wrong?
I resolved my issue when I updated gradle in my flutter project by:
Create a new temp project with the latest version of Flutter.
In the temp project open android/gradle/wrapper/gradle-wrapper.properties and check the distributionUrl. Update your old project to use the same one.
For me today the distributionUrl looks like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Rerun your app. It has to download the new version of gradle to the android/.gradle directory so the first time might take a while.

FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not find com.google.firebase:firebase-analytics:.
Required by:
project :app
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 45s
Exception: Gradle task assembleDebug failed with exit code 1
I am not really sure but try to :
Set your java SDK location in project settings
upgrade your buildToolsVersion in your build.gradle file. See which version is the latest and set it to that.
If neither of these methods work , save your project in a repository and re-download android studio if it comes to that.
You can even visit this thread and see if any of the methods solve your problem : Execution failed for task ':app:compileDebugJavaWithJavac' Android Studio 3.1 Update

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.

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

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