Today I thought I will start learning react-native and after some java and node installation
I run a command to create react-native app **npx react-native init myapp**
and then I tried to run it on an android emulator but I got this error
info Starting JS server...
info Installing the app...
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details
5 actionable tasks: 5 executed
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/android/local.properties'.
* 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 13s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/android/local.properties'.
* 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 13s
at makeError (/home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/node_modules/execa/index.js:174:9)
at /home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/home/satyam/Coding/1Code/React/ReactNativeBare/mittochat/node_modules/@react-native-community/cli/build/index.js:108:9)
info Run CLI with --verbose flag for more details.
can someone please help to solve this issue?
I was expecting it to run smoothly on the android emulator.