There is long time I had not developed any Android application (about 5 months) and now I have came back with nativescript. When I have created my first app using nativescript, I encountered this issue:
Executing before-shouldPrepare hook from C:\Data\ProjectFiles\NativeScript\HeavenlyMinutes\hooks\before-shouldPrepare\nativescript-dev-webpack.js Skipping prepare. Building project... Gradle build...
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'HeavenlyMinutes'.
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://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect Could not resolve com.android.tools.build:gradle:3.2.1. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] 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 48s Command gradlew.bat failed with exit code 1
So I have refered to my last projects created and developed using Android Studio. So the problem was there too. I have tested multiple configurations on gradle and for example two of them are mentioned below:
gradle.wrapper.properties
#Thu Sep 27 11:34:03 EEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
build.gradle (project dependencies)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com' }
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com' }
gradlePluginPortal()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle.wrapper.properties
#Thu Sep 27 11:34:03 EEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
build.gradle (project dependencies)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com' }
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com' }
gradlePluginPortal()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and none of them helped me. As my android projects were working before, I think the problem is somewhere else.
Note that the links https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar and https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom that are mentioned in the errors as unreachable links, are downloadable throw internet browser. So I think one possible solution will be to download them manually and put them somewhere in the project (but I have searched a lot how to do this and didn't find anything).
That was all about sanctions. I have tried some sanction-breaker and at last shecan solved my issue.
This answer will be useful only for Iranian users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With