Flutter: Gradle task assembleDebug failed (configuring root project 'android') - android

I'm using Android studio 3.6.1 on windows 10
(I'm new to flutter and this is my first try)
you can see my "flutter doctor" result here (all check):
flutter doctor command result
Unfortunately when I want to run my program this error Occurs:
android studio error
text:
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.5.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 127.0.0.1:2347 [/127.0.0.1] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 127.0.0.1:2347 [/127.0.0.1] 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 20s
Finished with error: Gradle task assembleDebug failed with exit code 1
I try all articles in Stack Overflow, YouTube and medium but I'm still stuck :(

Faced same problem, I resolved by;
Delete all files in .gradle folder and reopen Android studio to re-download and update to the latest files.
PATH: C:\Users\<YOUR-USER-NAME>\.gradle
This Worked for me. I hope it helps, then re-run flutter doctor command

Related

Nativescript Angular project Build failed

i just crate a simple Nativescript-angular project by:
ns create example-app --ng
and when i run that by:
ns run android
i get this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'core'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.1.2.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:7.1.2.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'. Received status code 403 from server: Forbidden
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.0/kotlin-gradle-plugin-1.6.0.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.0/kotlin-gradle-plugin-1.6.0.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 2s
Failed to build plugin #nativescript/core :
Error: Command gradlew.bat failed with exit code 1
how can i solve this?
regards'
finally, I find the reason.
google and gradle put some countries to ban list, so some of files and packages from they can't download without VPN.
I solve this issue just by buying a VPN account.

Problem with cordova emulate android and Gradle

I'm new in android apps development. I created a new ionic project. When I try in the console cordova emualte android it fails with this errors:
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:2.3.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom'.
> Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.4.215] failed: Connection timed out: 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 1m 7s
I try curl https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom in the console and worked.
Thanks for any help!!

Gradle build issues in flutter

Good day beautiful people. I am new to flutter. For the past 4 days, i have been trying build my first flutter project and here is what i see in my android studio.
***Launching lib\main.dart on Android SDK built for x86 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:3.5.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 192.168.43.253:80 [/192.168.43.253] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Connect to 192.168.43.253:80 [/192.168.43.253] failed: Connection refused: connect
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://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Connect to 192.168.43.253:80 [/192.168.43.253] failed: Connection refused: connect
> 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'.
> Connect to 192.168.43.253:80 [/192.168.43.253] 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 52s
Exception: Gradle task assembleDebug failed with exit code 1***
Can anyone help me with this issue?

react-native run-android command can not resolve all artifacts for configuration ':classpath'

When trying to run react-native run-android gradle can not resolve all configurations :classpath.
react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Connect to dl.google.com:443 [dl.google.com/172.217.21.238] failed: Connection timed out: connect
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/18.195.111.75, jcenter.bintray.com/35.156.75.35] failed: Connection timed out: 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 1m 4s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug
I already try all the solutions a could find, like adding google() to the allProjects repositories, etc.

Gradle build error: Could not resolve all dependencies for configuration ':classpath'

Please for days now, I have been trying to try with nativescript. All my installation went all fine but at the point of xecuting tns run android --emulator, it gives me the bellow error:
MiC#USER MINGW32 ~/Android-projects/HelloWorld
$ tns run android
Searching for devices...
Skipping prepare.
Building project...
Gradle build...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'HelloWorld'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.4.0-alpha7.
Required by:
project :
Could not resolve com.android.tools.build:gradle:2.4.0-alpha7.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.4.0-alpha7/gradle-2.4.0-alpha7.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.4.0-alpha7/gradle-2.4.0-alpha7.pom'.
Connect to jcenter.bintray.com:443 [jcenter.bintray.com/159.122.18.156] failed: Connection timed out: connect
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Unable to apply changes on device: 192.168.98.101:5555. Error is: Command gradlew.bat failed with exit code 1.
Please, what do I do to rectify this error?
Thank you for your response in advance.
Just delete the android folder in your project's platform folder.
and then run tns run android

Categories

Resources