Nativescript-cli: spawn gradle ENOENT

Created on 18 Nov 2015  ยท  7Comments  ยท  Source: NativeScript/nativescript-cli

With shell follows.

tns build android --log trace >  out.txt

Most helpful comment

delete platform/android directory and than run another time tns build android . it should work

All 7 comments

Exec uname -a 
 stdout: Darwin LLDE.lan 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64

 stderr: 
Exec npm -v 
 stdout: 3.3.12

 stderr: 
spawn: java -version
Exec node-gyp -v 
 stdout: v3.0.3

 stderr: 
Exec xcodebuild -version 
 stdout: Xcode 7.1.1
Build version 7B1005

 stderr: 
Exec pod --version 
 stdout:  
 stderr: /bin/sh: pod: command not found

Exec adb version 
 stdout: Android Debug Bridge version 1.0.32
Revision eac51f2bb6a8-android

 stderr: 
Exec android -h 
 stdout: 
       Usage:
       android [global options] action [action options]
       Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

                                                                    Valid
                                                                    actions
                                                                    are
                                                                    composed
                                                                    of a verb
                                                                    and an
                                                                    optional
                                                                    direct
                                                                    object:
-    sdk              : Displays the SDK Manager window.
-    avd              : Displays the AVD Manager window.
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
-   list sdk          : Lists remote SDK repository.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.
- update avd          : Updates an Android Virtual Device to match the folders
                        of a new SDK.
- create project      : Creates a new Android project.
- update project      : Updates an Android project (must already have an
                        AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
                        already have an AndroidManifest.xml).
- create lib-project  : Creates a new Android library project.
- update lib-project  : Updates an Android library project (must already have
                        an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb          : Updates adb to support the USB devices declared in the
                        SDK add-ons.
- update sdk          : Updates the SDK by suggesting new platforms to install
                        if available.

 stderr: 
Exec mono --version 
 stdout:  
 stderr: /bin/sh: mono: command not found

Exec git --version 
 stdout: git version 2.4.9 (Apple Git-60)

 stderr: 
Exec gradle -v 
 stdout: 
------------------------------------------------------------
Gradle 2.4
------------------------------------------------------------

Build time:   2015-05-05 08:09:24 UTC
Build number: none
Revision:     5c9c3bc20ca1c281ac7972643f1e2d190f2c943c

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM:          1.8.0_66 (Oracle Corporation 25.66-b17)
OS:           Mac OS X 10.11.1 x86_64


 stderr: 
Exec javac -version 
 stdout:  
 stderr: javac 1.8.0_66

System information:
{ procInfo: 'nativescript/1.4.3',
  platform: 'darwin',
  os: 'Darwin LLDE.lan 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v5.1.0',
  npmVer: '3.3.12',
  javaVer: '1.8.0',
  nodeGypVer: 'v3.0.3\n',
  xcodeVer: 'Xcode 7.1.1\nBuild version 7B1005\n',
  itunesInstalled: true,
  cocoapodVer: null,
  adbVer: 'Android Debug Bridge version 1.0.32',
  androidInstalled: true,
  monoVer: null,
  gitVer: '2.4.9 (Apple Git-60)',
  gradleVer: '2.4',
  javacVersion: '1.8.0_66' }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'build'.
AnalyticsInstallationID: 0855b416-5dda-4b34-9c10-196caad65157
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
BeforeHookName for command build-android is before-build-android
AfterHookName for command build-android is after-build-android
Looking for project in '/Users/ldoa/workspace/webstorm/NativeScriptPlay/XCPadNative'
Project directory is '/Users/ldoa/workspace/webstorm/NativeScriptPlay/XCPadNative'.
spawn: adb version
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'build|android'.
BeforeHookName for command build|android is before-build
AfterHookName for command build|android is after-build
Project successfully prepared
Exec android list targets 
 stdout: Available Android targets:
----------
id: 1 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 2 or "android-20"
     Name: Android 4.4W.2
     Type: Platform
     API level: 20
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 3 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/armeabi-v7a, default/x86_64
----------
id: 4 or "android-22"
     Name: Android 5.1.1
     Type: Platform
     API level: 22
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 5 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 1
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.

 stderr: 
Versions found in /Users/ldoa/env/android-sdk-macosx/build-tools are 20.0.0, 21.1.2, 22.0.1, 23.0.0, 23.0.1
Selected targetSdk is: 23
Versions found in /Users/ldoa/env/android-sdk-macosx/extras/android/m2repository/com/android/support/appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1
Selected AppCompat version is: 23.1.1
spawn: gradle buildapk -PcompileSdk=android-23 -PtargetSdk=23 -PbuildToolsVersion=23.0.1 -PsupportVersion=23.1.1
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'help'.
List of registered commands: /?, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, create, debug, debug|android, debug|ios, deploy, device, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, init, install, library, library|add, livesync, platform, platform|add, platform|remove, platform|update, plugin, plugin|add, plugin|remove, prepare, run, run|android, run|ios, usage-reporting
Reading help for command 'build|android'. FileName is 'build-android.md'.
# build android
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Usage   โ”‚ Synopsis                                                                                                                                                                                                                             โ”‚
โ”‚ General โ”‚ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --static-bindings - This is an experimental feature. If set, generates static bindings from your JavaScript code to corresponding native Android APIs during build. This static bindings speed up app loading.**
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.

** By default, NativeScript runtime for Android uses runtime binding generator. When you extend a Java class and overwrite a lot of methods, this could be a potentially slow operation.

### Attributes
<API Level> is a valid Android API level. For example: 22, 23.


Hi @gordonpro
This is really strange, may I ask you to navigate to platforms/android directory inside your project and execute
gradle buildapk -PcompileSdk=android-23 -PtargetSdk=23 -PbuildToolsVersion=23.0.1 -PsupportVersion=23.1.1 2>out.txt
Also I've noticed you are using node 5.1.0, which is not verified as supported, so I cannot guarantee everything will work as expected. The verified versions of nodejs are 0.10.40, 0.12.7 and 4.2.x

@rosen-vladimirov
It works fine. navigated to platform/android.
The reason may be gradle cannot find the build.gradle file when tns build android execute.

Hi @gordonpro ,
I've noticed you've closed this issue, may I ask you for more details what caused the problem on your side, so other users can use it as a reference in similar case?

I don't know, I followed the Get Started of nativescript.org. and one step by one step.
When I execute tns build android. it results the problem.

delete platform/android directory and than run another time tns build android . it should work

I discovered the cause is when you have not installed gradle, I executed the command @rosen-vladimirov mentioned https://github.com/NativeScript/nativescript-cli/issues/1214#issuecomment-157817236 , then I checked the .txt file it generates:

zsh: command not found: gradle

If you get that message you will need to install gradle:
https://www.jayway.com/2013/05/12/getting-started-with-gradle/

And that fix the problem!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erjdriver picture erjdriver  ยท  3Comments

ZMW9 picture ZMW9  ยท  3Comments

charsleysa picture charsleysa  ยท  3Comments

NickIliev picture NickIliev  ยท  3Comments

jerbob92 picture jerbob92  ยท  3Comments