npm run android doesn't work
See original GitHub issueDescribe the bug I can run react native android apps in other projects. With a clean run of your instructions, I can’t get the android project to run. I follow the installation instructions, cd into my project and try npm run android, which produces the following message:
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. Run CLI with --verbose flag for more details.
Error: spawnSync ./gradlew EACCES
at Object.spawnSync (internal/child_process.js:1002:20)
at spawnSync (child_process.js:614:24)
at execFileSync (child_process.js:642:13)
at runOnAllDevices (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
at then.result (/Users/ianphilips/Documents/corro/cross-platform/corro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! corro@0.1.0 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the corro@0.1.0 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ianphilips/.npm/_logs/2020-04-09T19_41_39_022Z-debug.log
To Reproduce
npx create-react-native-web-app myApp
cd myApp
npm run android
OS Mac OS v 10.15.3
Expected behavior The android app should run out of the box
Additional context
If I clone the repo, cd into template, npm install and npm run android this will at least install on the phone though there are some other seemingly unrelated errors.
npm run web does work fine.
I tried opening the android folder in android studio from the stack overflow q but this didn’t help.
my .zshrc has the android sdk correctly setup: 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Related StackOverflow Question
Thank you for the quick fix! I tried it again on the latest version and
npm run androidis working now. 🎉@IanPhilips @JessicaYeh Thank you for raising up the issue. I have just release a patch version 0.15.3 please try again and if it fails run:
npx create-react-native-web-app --versionthen output should be: 0.15.3Many thanks