Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio setting node directory for build (Cause: error=2, No such file or directory)

My project build fails because it's using the incorrect directory to run Node. How do I go about setting the Node directory for these compile-time tasks?

The specific task is:

app:recordFilesBeforeBundleCommandDebug

And the related error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:recordFilesBeforeBundleCommandDebug'.
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'node''
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'node'
Caused by: java.io.IOException: Cannot run program "node" (in directory "/Users/me/Code/appname/android/app"): error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory
like image 674
Nathanael Avatar asked Oct 30 '18 03:10

Nathanael


People also ask

How to fix “SDK tools Directory missing” in Android Studio?

So to fix “SDK tools directory missing” in android studio, try the following methods The Cause for this error -SDK tools package might not be installed. Quick fix: Go to the Tools –> SDK manager –> SDK tools. Deselect Hide obsolete packages option on the right bottom and further install Android SDK Tools (obsolete).

Why is my Android Studio build taking so long?

Some antivirus software can interfere with the Android Studio build process, causing builds to run dramatically slower. When you run a build in Android Studio, Gradle compiles your app’s resources and source code and then packages the compiled resources together in an APK. During this process, many files are created on your computer.

How do I Find my configuration file in Android Studio?

Note: An easy way to locate your configuration directory is to navigate to Help > Edit Custom VM Options in Android Studio. This will open a configuration file. Inspect the path of the configuration file to find your configuration directory. You can also use the following environment variables to point to specific override files elsewhere:

Which Android Studio files should be excluded from real-time scanning?

The following list shows the default location of each Android Studio directory that you should exclude from real-time scanning: Gradle cache %USERPROFILE%.gradle Android Studio projects %USERPROFILE%AndroidStudioProjects Android SDK %USERPROFILE%AppDataLocalAndroidSDK. Android Studio system files. Syntax: %LOCALAPPDATA%Google<product><version>


2 Answers

It is a known bug for the environment:

  • Apple chip M1
  • Android Studio arctic fox 2020.3.1 Patch 3

Upgrade to Gradle version 6.9 or above in the gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip

https://docs.gradle.org/6.9/release-notes.html

like image 148
batman Avatar answered Oct 15 '22 00:10

batman


I am running Android Studio on MacOS and following worked for me: Yoruba's answer above and starting the application from Terminal with open -a "Android Studio.app"

like image 39
Urska Avatar answered Oct 15 '22 00:10

Urska