3

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

Zoe
  • 27,060
  • 21
  • 118
  • 148
ConductedClever
  • 4,175
  • 2
  • 35
  • 69
  • 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 Dec 18 '18 at 17:43
  • 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 Dec 18 '18 at 21:38
  • @Baskar it is not about tns, but is about problem in fetching gradle package from `google()` repo. – ConductedClever Dec 19 '18 at 05:11
  • 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 Dec 19 '18 at 05:15
  • 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 Dec 19 '18 at 20:00

2 Answers2

2

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.

ConductedClever
  • 4,175
  • 2
  • 35
  • 69
  • Cubans also need that my friend, how we can use shecan please? – Rolando Corratge Nieves Feb 07 '19 at 16:27
  • 1
    I'm not pretty sure if shecan will work in your country or not, but in the website, a DNS Server is offered and it is enough to just configure your DNS configuration (on OS) to point this DNS Server. That's it. But I think this won't work in your country and you may ask shekan developers, to help you develop one for your people. I think this helps you. – ConductedClever Feb 09 '19 at 06:48
  • hi im from iran and im using shecan(i have green message that you are using shecan in thier website) but still have problem to download requirement – devmrh Apr 21 '19 at 05:48
  • May be you are using some proxies or vpns which are breaking the job. But I really don't know. I wish you could solve it. – ConductedClever Apr 21 '19 at 07:12
  • Dude u totally solved my problem ...Thanks...Mamnun :D – Mehdi Nourollah Jun 22 '19 at 14:06
0

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

sting
  • 1