Gradle build issues in flutter - android

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?

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.

> Could not resolve com.android.tools.build:gradle:3.5.0

I have this error when I built flutter project :
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'.
> YOUR_HOST
> 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'.
> YOUR_HOST
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> YOUR_HOST
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'.
> YOUR_HOST
> 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'.
> YOUR_HOST
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> YOUR_HOST
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
BULD FAILED in 3s
Exception: Gradle task assembly debug failed with exit code 1
This kind of issue usually appears either due to a gradle misconfig or in your case, it looks more of an internet issue.
Try running flutter clean in your project source and then using flutter build appbundle and check whether you're able to run the command without any errors.
In case, you're still facing any errors, go to android/build.gradle in your flutter project and edit this line
from classpath 'com.android.tools.build:gradle:3.5.0'
to classpath 'com.android.tools.build:gradle:3.4.2
Then repeat the above steps again with flutter clean and flutter build appbundle.
It should work.
run Flutter upgrade first
flutter upgrade
then run flutter clean
flutter clean

Flutter: Gradle task assembleDebug failed (configuring root project '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

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.

Fresh Cordova build error

I just installed a fresh copy of Cordova on Windows 10 and am trying to build my first Android app (using this guide). It seems like the script couldn't download gradle-2.2.0.pom, I tried the URL and indeed the file isn't there. I am not sure where to go from here :/
c:\test\hello>cordova build android
ANDROID_HOME=C:\Users\Stuffe\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_112
Subproject Path: CordovaLib
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.0.
Required by:
:android:unspecified
> Could not resolve com.android.tools.build:gradle:2.2.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Connect to repo1.maven.org:443 [repo1.maven.org/127.0.1.2] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:2.2.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
>
BUILD FAILED
Total time: 3.134 secs
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/127.0.1.3] 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.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.0.
Required by:
:android:unspecified
> Could not resolve com.android.tools.build:gradle:2.2.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Connect to repo1.maven.org:443 [repo1.maven.org/127.0.1.2] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:2.2.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/127.0.1.3] 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.
Remove the latest version of gradle and install gradle 2.1.4. Now try to build again. It worked for me.

Categories

Resources