Navigation

Related Articles

Back to Latest Articles
Fixing React native gradlew access error

Fixing React native gradlew access error

How to fix React native ./gradlew access error


Baraa Abuzaid
Baraa Abuzaid
@baraaabuzaid
Fixing React native gradlew access error

If you are getting this error and you are pulling your hair off try to figure out what goes wrong! look no further here are few steps you can take to solve this issue.

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment.
Error: spawnSync ./gradlew EACCES
    at Object.spawnSync (internal/child_process.js:1041:20)
    at spawnSync (child_process.js:607:24)
    at execFileSync (child_process.js:634:15)

./gradlew EACCES
Make sure your Environment variable are setup correctly. This environment variable allow react native CLI to access android SDK

use this if you are on visual studio code

code  ~/.bash_profile

or this if you know how to exist vim

vim ~/.bash_profile

or

touch ~/.bash_profile; open ~/.bash_profile

Then you can add the following lines and save. Now react native is able to access android SDK tools allowing it to run your app.

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Not yet done. after this you should add the right access permission for file ./gradlew
this could be done by opening your terminal and adding this

chmod 755 android/gradlew 

hopefully this helps you to resolve ./gradlew EACCES error.

Show Comments (0)

Comments

Related Articles

React Suspense And Fetching Approach
General

React Suspense And Fetching Approach

When it comes to fetching and rendering content in a React App, there are a few key strategies to consider: Fetch on render, Fetch then render, fetch as you render. Of these, the...

Posted on by Baraa Abuzaid
Set a new user with password login on AWS EC2 linux Instance
AWS

Set a new user with password login on AWS EC2 linux Instance

Login to your elastic compute instance with a private-key each time isn’t quite convenient. So we will change that by creating a new user, set ssh config and enabling...

Posted on by Baraa Abuzaid