Helloworld build failed on windows for Android


#1

I am starting with hello world example to learn nativescript.
I am compiling and building code behind corporate explicit proxy. I am able to create project and add android platform in my project. but when i try to build the project I face below error. [Gradle]('https://jcenter.bintray.com/com/android/tools/bu ild/gradle-core/2.1.2/gradle-core-2.1.2.jar) is accessible from browser. But “tns build android” or “tns run android” couldn’t download and give error.

Your help will be appreciated.

D:\CurrentProjects\Android\NativeScript\simple>tns run android
Executing before-prepare hook from D:\CurrentProjects\Android\NativeScript\simpl
e\hooks\before-prepare\nativescript-dev-android-snapshot.js
Preparing project...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'simple'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not download gradle-core.jar (com.android.tools.build:gradle-core:2.1
.2)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/bu
ild/gradle-core/2.1.2/gradle-core-2.1.2.jar'.
         > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gr
adle-core/2.1.2/gradle-core-2.1.2.jar'.
            > This is usually a temporary error during hostname resolution and m
eans that the local server did not receive a response from an authoritative serv
er (jcenter.bintray.com)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 21.159 secs
Processing node_modules failed. Error: Command D:\CurrentProjects\Android\Native
Script\simple\platforms\android\gradlew.bat failed with exit code 1


#2

As per stackoverflow this problem was solved by gradle but why tns build still face this problem?

http://stackoverflow.com/questions/8938994/gradlew-behind-a-proxy

If problem persists then I am afraid I have to leave coding in nativescript …And it would be shame as I had invested lot of time coming to this stage…


#3

You can go into your platforms/android folder and manually type gradlew with whatever proxy info you need to have it download gradle properly on your machine. Once you have gradle; then then normal tns command should work properly.

Nathanael A.


#4

Found the answer to setting.

http://stackoverflow.com/a/32344111/3354591