AVD Manager:
Nexus 6p with Android R and Android Pie

Installed SDK:

SDK Platforms

bash_profile or bashrc
Command Used: nano .bash_profile
export ANDROID_HOME=/Users/user/Library/Android/sdk
export PATH=${PATH}:/Users/user/Library/Android/sdk/tools
export PATH=${PATH}:/Users/user/Library/Android/sdk/platform-tools
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
Command used: npx @react-native-community/cli doctor
user@Devs-Mac MyReactApp % npx @react-native-community/cli doctor
Common
✓ Node.js
✓ yarn
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ JDK
✖ ANDROID_HOME
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 28.0.3
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ CocoaPods - Required for installing iOS dependencies
✓ ios-deploy - Required for installing your app on a physical device with the CLI
Command used: npx react-native run-android
user@Devs-Mac MyReactApp % npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 748ms
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 748ms
at makeError (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:174:9)
at /Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli/build/index.js:186:9)
File local.properties inside android folder of React-native project
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Apr 21 17:57:13 IST 2020
sdk.dir=/Users/user/Library/Android/sdk
Command: react-native info Environment Information
user@Devs-Mac MyReactApp % react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Memory: 8.14 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.13.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6308749
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
Languages:
Java: 14.0.1 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Even ran brew cask install android-sdk Just to make it work
Logs Below
user@Devs-Mac ~ % brew cask install android-sdk
Updating Homebrew...
==> Caveats
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"'
android-sdk requires Java 8. You can install it with:
brew cask install homebrew/cask-versions/adoptopenjdk8
==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'android-sdk'.
==> Installing Cask android-sdk
==> Linking Binary 'android' to '/usr/local/bin/android'.
==> Linking Binary 'archquery' to '/usr/local/bin/archquery'.
==> Linking Binary 'avdmanager' to '/usr/local/bin/avdmanager'.
==> Linking Binary 'jobb' to '/usr/local/bin/jobb'.
==> Linking Binary 'lint' to '/usr/local/bin/lint'.
==> Linking Binary 'monkeyrunner' to '/usr/local/bin/monkeyrunner'.
==> Linking Binary 'screenshot2' to '/usr/local/bin/screenshot2'.
==> Linking Binary 'sdkmanager' to '/usr/local/bin/sdkmanager'.
==> Linking Binary 'uiautomatorviewer' to '/usr/local/bin/uiautomatorviewer'.
==> Linking Binary 'emulator' to '/usr/local/bin/emulator'.
==> Linking Binary 'emulator-check' to '/usr/local/bin/emulator-check'.
==> Linking Binary 'mksdcard' to '/usr/local/bin/mksdcard'.
==> Linking Binary 'monitor' to '/usr/local/bin/monitor'.
🍺 android-sdk was successfully installed!
Issue Still same
| :warning: | Missing Environment Information |
|---|---|
| :information_source: | Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console. |
⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by runningreact-native infoin a console.
Hi I have updated Question with Environment Information. It says Android SDK missing. But I have already installed it
@RockinGarg i hope it helps you
1、open a terminal
2、touch ~/.bash_profile
3、open ~/.bash_profile
4、write
export ANDROID_HOME=/Users/yourname/Library/Android/sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
5、source ~/.bash_profile(if it doesn't work,next)
6、change "android": "react-native run-android" to "android": "source ~/.bash_profile&&react-native run-android", and run yarn android


Can confirm this bug. Started a new project last night and ran up against this. Tried again, and tried @sunguoxing0628's suggestions, but still getting this:

Environment details:
And just in case the react-native info output is helpful:
System:
OS: macOS 10.15.3
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 177.10 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
npmPackages:
react: ~16.9.0 => 16.9.0
react-native: ~0.61.5 => 0.61.5
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
edit: updated env details
@jwd2a
Before that, I used Android Studio to install the gradle and run the app. I don't know if it has any impact.
yarn android
Hi @sunguoxing0628 none worked for me I tried your solutions
For now I used Android Studio to Build App once. But it is still issue that it doesn't work with command Line
my environment information.
$ source ~/.bash_profile&&react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 1.89 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.16.2 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
Android NDK: 21.0.6113669
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
Languages:
Java: 11.0.6 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
$ source ~/.bash_profile&&npx @react-native-community/cli doctor
✓ Node.js
✓ yarn
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ JDK
✓ ANDROID_HOME
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 28.0.3
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ CocoaPods - Required for installing iOS dependencies
✓ ios-deploy - Required for installing your app on a physical device with the CLI
$ source ~/.bash_profile&&react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_2_API_21(AVD) - 5.0.2' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 16s
26 actionable tasks: 2 executed, 24 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.egos_app/.MainActivity }
✨ Done in 24.42s.
Hi,
Shell: 5.7.1 - /bin/zsh
Your shell is zsh, not bash. Therefore you need to source your .bash_profile in zshrc file.
Just add the line below into ~/.zshrc
source ~/.bash_profile
Then restart your terminal or source your ~/.zshrc by using the code below
source ~/.zshrc
To check adb:
adb --version
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
Open Android Studio AVD Manager, then create an emulator if you have no emulators.
If you have emulators, then wipe their data and rerun
npx react-native run-android
Hi All
Attaching info again It says Android SDK: Not Found which looks like the main reason that it not letting me launch Emulator from react-native command
But I had already installed Android SDK and Android Studio Too
user@Devs-Mac MyReactApp % react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Memory: 11.32 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.13.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
**Android SDK: Not Found**
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6308749
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
Languages:
Java: 14.0.1 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
If I'm understanding correctly this works when running directly but not from the CLI? Did the last set of tips about your bash config help? Have you been able to get react-native doctor to run clean? Is that still giving the same failures?
Hi yes you are right
I am to run in android through android studio
But not through CLI
Bash changes i made as suggested none worked
React-native doctor says
AndroidSDK: not found
But its installed
This is happening for me too. It was all working fine yesterday, I could run my RN app on both iOS and Android.
Today however, I'm getting this error from Android when using npx react-native run-android:
java.lang.RuntimeException: Unable to instantiate application <my identifier>.MainApplication: java.lang.ClassNotFoundException: Didn't find class "<my identifier>.MainApplication"
Doing npx react-native doctor gives:
✓ Node.js
✓ yarn
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ ANDROID_HOME
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 28.0.3
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ CocoaPods - Required for installing iOS dependencies
✓ ios-deploy - Required for installing your app on a physical device with the CLI
I followed the installation instructions to the T, and it was all working correctly yesterday. That suggests to me there's something up with the environment variables but I can't work out what it is. Here's my .bash_profile:
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
Running source ~/.bash_profile && npx react-native doctor gives the same output as above.
Update: running this appears to fix the issue. No idea why.
cd android && ./gradlew clean
Hi @Developius
that seems helped me with previous error
now I get below log
user@Devs-Mac MyReactApp % npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 990 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :react-native-webview:compileDebugJavaWithJavac
> Task :app:compileDebugJavaWithJavac
> Task :app:stripDebugDebugSymbols
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so.
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' for app:debug
Installed on 1 device.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 24s
47 actionable tasks: 47 executed
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: spawnSync adb ENOENT
at Object.spawnSync (internal/child_process.js:1045:20)
at Object.spawnSync (child_process.js:597:24)
at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30)
at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22)
at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39
at Array.forEach (<anonymous>)
at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
@gokhandoslu It works great for me! Thanks a lot.
@RockinGarg There were plenty of errors/warnings in that log to follow up on. Did you end up getting unblocked?
Hi I used Android Studio to manually install Build on Android Emulator then manually launch the App by running server.
I am still unable to use
react-native run-android (Doesn't Work)
whereas
react-native run-is (Works Perfect)
Hi @developius
that seems helped me with previous error
now I get below loguser@Devs-Mac MyReactApp % npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 990 file(s) to forward-jetify. Using 8 workers... info Starting JS server... /bin/sh: adb: command not found info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... > Task :react-native-webview:compileDebugJavaWithJavac > Task :app:compileDebugJavaWithJavac > Task :app:stripDebugDebugSymbols WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570. Compatible side by side NDK version was not found. Default is 20.0.5594570. Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so. > Task :app:installDebug Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' for app:debug Installed on 1 device. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 24s 47 actionable tasks: 47 executed info Connecting to the development server... warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT info Starting the app... error Failed to start the app. Run CLI with --verbose flag for more details. Error: spawnSync adb ENOENT at Object.spawnSync (internal/child_process.js:1045:20) at Object.spawnSync (child_process.js:597:24) at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30) at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22) at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39 at Array.forEach (<anonymous>) at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
I have the same error with you, so I launch the app in Android Studio, It work well。
Hi @developius
that seems helped me with previous error
now I get below loguser@Devs-Mac MyReactApp % npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 990 file(s) to forward-jetify. Using 8 workers... info Starting JS server... /bin/sh: adb: command not found info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... > Task :react-native-webview:compileDebugJavaWithJavac > Task :app:compileDebugJavaWithJavac > Task :app:stripDebugDebugSymbols WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570. Compatible side by side NDK version was not found. Default is 20.0.5594570. Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so. > Task :app:installDebug Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' for app:debug Installed on 1 device. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 24s 47 actionable tasks: 47 executed info Connecting to the development server... warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT info Starting the app... error Failed to start the app. Run CLI with --verbose flag for more details. Error: spawnSync adb ENOENT at Object.spawnSync (internal/child_process.js:1045:20) at Object.spawnSync (child_process.js:597:24) at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30) at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22) at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39 at Array.forEach (<anonymous>) at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
what are you doing here for be like this
i have the same initial issues
@Mhde96 @mylesshie @RockinGarg
Your logs include a message about missing adb (/bin/sh: adb: command not found). I would suggest making sure adb is installed before trying to debug anything else. Also, react-native doctor is your friend.
Hello, I am experiencing a similar issue in my macOS + Android Studio setup when running react-native run-android from the command line.
The only way I can get it to work is by building the project from Android Studio. Also:
I tried ./gradlew clean in the ./android folder but that alone fails as well.
I have checked my .zshrc setup a few times. I even hardcoded $ANDROID_HOME to the path found in Android Studio's settings.
This is occurring with the 0.63.3 release. Could someone please advise?
This is the error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 448ms
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
And the info from react-native info:
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 1.64 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.13.0 - ~/.nvm/versions/node/v14.13.0/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 29
Build Tools: 28.0.3, 29.0.2, 30.0.2
System Images: android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6858069
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: javac 15 - /usr/bin/javac
Python: 3.8.3 - /Users/diegoserrano/.pyenv/shims/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
The result of running react-native doctor:
✓ Node.js
✓ yarn
✓ Watchman - Used for watching changes in the filesystem when in development mode
Android
✓ JDK
✓ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME
iOS
✓ Xcode - Required for building and installing your app on iOS
✓ CocoaPods - Required for installing iOS dependencies
● ios-deploy - Required for installing your app on a physical device with the CLI
Errors: 0
Warnings: 1
I am facing the same issue.
Wow, this is open for a long time.
Setting up a $JAVA_HOME variable to point to the adoptopenjdk11 I installed through homebrew helped with this issue.
In my case, it seemed like a past JRE/JDK installation was interfering. I can also run gradlew commands now.
Would be helpful to mention adding $JAVA_HOME in the docs.
Setting up a
$JAVA_HOMEvariable to point to the adoptopenjdk11 I installed through homebrew helped with this issue.
In my case, it seemed like a past JRE/JDK installation was interfering. I can also run gradlew commands now.Would be helpful to mention adding
$JAVA_HOMEin the docs.
Hi can you share your full bash_profile or where have you set java_home variable
@RockinGarg I use zsh. This is my .zshrc configuration for react-native:
export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8)
export JAVA_HOME_11=$(/usr/libexec/java_home -v11)
export JAVA_HOME=$JAVA_HOME_11
export ANDROID_HOME=/Users/diegoserrano/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
In my case I had to install Android SDK Command-line Tools (in SDK Manager > SDK Tools) in order to react-native doctor recognise Android SDK
This link(https://stackoverflow.com/questions/35000729/android-studio-could-not-initialize-class-org-codehaus-groovy-runtime-invokerhel) and @campsjos's comment helped me to fix the issues for run-android command.
I would like to close this issue
It’s been long i am working on react native and found this command fails sometimes and sometimes that’s work it’s intermittent.
If app is already installed then this command works fine else it fails
If anyone think this issue is occurring feel free to open
My observation
Call
source ~./bash_profile before you run
react-native run-android command
This makes it works sometimes
Most helpful comment
@RockinGarg i hope it helps you
1、open a terminal
2、
touch ~/.bash_profile3、
open ~/.bash_profile4、write
5、source ~/.bash_profile(if it doesn't work,next)
6、change
"android": "react-native run-android"to"android": "source ~/.bash_profile&&react-native run-android", and runyarn android