Gradle problem with tns run


#1

Hi everyone,
I’m getting started with NativeScript. I could manage to setup my dev environment for android and tns doctor reports no error. However, when I try to run a newly created project or even the sample-Groceries project using “tns run android”, I encounter an annoying Gradle error that says it cannot find a specific resource via HTTP GET. Without any stacktrace or additional command switch, the output looks like this :

===============================================================
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘groceries’.

Could not resolve all files for configuration ‘:classpath’.
Could not find com.android.tools.build:gradle:3.1.2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.jar
Required by:
project :

  • 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 …

BUILD FAILED in 4s
Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

I’m not behind any HTTP proxy and when trying to get specified resource from browser, I get a json object stating that the resource was not found. I’m using the following environment :

NativeScript v4.1.2
Node v8.10.0
npm v5.6.0

Any help will be warmly appreciated.
Thanks in advance


#2

Are you using Windows machine? May I know your gradle version?


#3

Yes, I’m developing on a 64-bit Windows 10 machine. I’m not sure about Gradle version, but it seems like the version 3.1.2 is being used under the covers.