Recently I’ve started learning mobile apps development using flutter. However, I’m still facing this error. Whenever I try to run my app it takes kinda long time to load and then it shows me this error:
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 download bundletool-0.14.0.jar (com.android.tools.build:bundletool:0.14.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.14.0/bundletool-0.14.0.jar'.
> Premature end of Content-Length delimited message body (expected: ?????????; received: ?????????)
> Could not download kotlin-compiler-embeddable-1.3.50.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.3.50/kotlin-compiler-embeddable-1.3.50.jar'.
> Premature end of Content-Length delimited message body (expected: ??????????; received: ?????????)
* 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 26m 32s
Running Gradle task 'assembleDebug'...
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
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 download bundletool-0.14.0.jar (com.android.tools.build:bundletool:0.14.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.14.0/bundletool-0.14.0.jar'.
> Premature end of Content-Length delimited message body (expected: ?????????; received: ???????)
> Could not download kotlin-compiler-embeddable-1.3.50.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.3.50/kotlin-compiler-embeddable-1.3.50.jar'.
> Premature end of Content-Length delimited message body (expected: ??????????; received: ???????)
* 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 58s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1
It seems like there is some network issue -which is expected since I have a poor network connection-, so I tried to download the required .jar files manually. But I don’t know where I should place those files yet don’t know if that could fix this error.
any ideas?
2
Answers
This error occurred after solving network issue:
The error message you’re seeing indicates that Gradle is having trouble downloading certain artifacts while building your Android project for your Flutter app. This can be caused by network issues, problems with the repositories, or specific Gradle configurations. To resolve this issue, you can try the following steps:
Check Your Internet Connection:
Ensure that you have a stable internet connection. Sometimes network issues can cause problems with downloading dependencies.
Clear Gradle Cache:
Gradle caches downloaded dependencies, and sometimes this cache can become corrupted. You can try clearing the Gradle cache by running the following command in your project’s root directory: