Android-runtime: Build failed when open and run project in Android Studio on Mac

Created on 24 Nov 2017  路  3Comments  路  Source: NativeScript/android-runtime

Tell us about the problem

On Mac - Trying to run app in Android Studio ends with

FAILURE: Build failed with an exception.

* Where:
Build file '/Volumes/NHRISTOVA/Work/NS-UI/App14/platforms/android/build-tools/android-static-binding-generator/build.gradle' line: 231

* What went wrong:
Execution failed for task ':asbg:runAstParser'.
> java.io.IOException: Cannot run program "node": error=2, No such file or directory

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.4.0-2017-11-15-10117
  • Cross-platform modules: 3.3.0
  • Runtime(s): "tns-android": {
    "version": "3.4.0-2017-11-13-2"
    }

Please tell us how to recreate the issue in as much detail as possible.

  1. tns create SomeApp, cd SomeApp
  2. tns platform add android@next
  3. tns prepare android
  4. Open /platforms/android/build.gradle in Android Studio and try to run it from there

_NOTE: Works on Windows_

bug

Most helpful comment

Update: turns out Android Studio doesn't inherit the PATH env variables. As a workaround Android Studio can be started through the terminal as described in this comment

All 3 comments

After investigating, I found out android studio in mac can't find the executables in the PATH, where the node executable is, when ArrayList.execute() is used. We should find a new way to run this command with gradle, and the problem should be fixed.

Update: turns out Android Studio doesn't inherit the PATH env variables. As a workaround Android Studio can be started through the terminal as described in this comment

Update: Triied using several node plugins for gradle, but they have the same issue. This issue can be solved with an init.gradle script in the $GRADLE_HOME directory, but it would be simpler to start Android Studio on mac through the terminal, and seems like a legitimate solution to the problem until gradle allows better usage of executables in the $PATH.
Closing this issue, because the effort of making gradle work automatically is not worth considering the workaround provided. Will reopen if gradle figures out a way to start executables on mac.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ProMasoud picture ProMasoud  路  3Comments

zahid-dapperapps picture zahid-dapperapps  路  5Comments

NathanaelA picture NathanaelA  路  4Comments

NathanaelA picture NathanaelA  路  3Comments

zahid-dapperapps picture zahid-dapperapps  路  3Comments