error Failed to install the app. Make sure you have an Android emulator running or a device connected. 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:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 3s
at checkExecSyncError (child_process.js:637:11)
at execFileSync (child_process.js:655:13)
at runOnAllDevices (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:169:41)
at then.result (/Users/danale/Projects/engageMobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:135:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
react-native run-ios は自動的にエミュレーターを開きますが、react-native run-android はそうではありません。重要な点は、同様のコマンドであり、同様のこと、つまりエミュレーターを開きません。
Android Studio 内でアプリを開き、AVD マネージャーに移動し、Android Studio のエミュレーターを開き、react-native run-android を実行すると、正常に動作するはずです。
1. 環境を確認します: https://reactnative.dev/docs/environment-setup
2. 問題を解決します: https://stackoverflow.com/questions/57097192/react-native-error-failed-to-install-the-app-make-sure-you-have-an-android-emu