Issue
Trying to run my React Native app in Android emulator but it keeps throwing error:
"Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error spawnSync ./gradlew EACCES. Run CLI with --verbose flag for more details."
Tried react-native run-android, npm start, react-native start... nothing worked!!!
Am I missing out something here?? struggling with this since morning. Please help....
Update:
Ran "adb devices" in terminal. Still its not working :/ Same error!!!
Solution
Check the permission on android/gradew. It should be 755 and not 644.
Run the following command inside your app root folder:
chmod 755 android/gradlew
The run: react-native run-android. If you are on Windows, make sure to run react-native run-android in CMD as administrator.
Hope it helps :)
EDIT for the new problem in the comments:
The following are a few ways you can try to fix the error you mentioned in the comments:
1) Go to FILE -> sync project with gradle files.
If no.1 doesn't work for you. Try no.2
2) Go to .gradle\caches\2.0\scripts\build_7l4t45nbnsvdcl79ol8u0beli4\ProjectScript and remove the cache.properties.lock file. If you are on windows try this as: C:\Users\<username>\.gradle\caches\<gradle version such as 2.4 or something else>\scripts>del /S *.lock
Hope this solves your problem :)
EDIT 2:
You can downgrade from your Java 13 to Java 8. It may solve your problems. However, if you are unwilling to downgrade go to build.gradle and do the following:
compileJava.options.fork = true
compileJava.options.forkOptions.executable = /path_to_javac
If you do the following above instead of downgrading you will set a concrete path which will hinder your project if you are sharing it with other developers.
This was the best I could come up with from simulating the same problem on one of my test projects in my computer. Hope it helps :)
Answered By - Mahir Islam



0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.