3
votes

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.

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:

One

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
}

Two

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).

2
what is the CLI version you are using .. try to run tns update on the existing project so that it updates to latest version. - Baskar Rao
Hi ConductedClever. I notice from your post history that you sign your questions - please don't do that. It's noted in the Help Centre that we ask folks to refrain from signatures and greetings. In general, you posts are quite chatty and carry a certain pleading tone - if you can keep them succinct then there's less stuff to read, and you may get a better reception too. - halfer
@Baskar it is not about tns, but is about problem in fetching gradle package from google() repo. - ConductedClever
Hi @halfer. Not exactly signs. by TG I meen something not signing the question. I need them in my notes for myself. I got your note. Thanks. - ConductedClever
I don't understand your message to me, but please do not add them again, whatever they are. If you are in doubt as to whether they are permitted, I can find the relevant help page for you. - halfer

2 Answers

2
votes

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.

0
votes

Finally, remove the proxy config in gradle.properties in .gradle folder, it words.Hope this answer will be useful.