I have created the project very well and I have also installed the android studio and all the required sdks. but still I am still facing a problem of the emulator not starting. below is error in the terminal.
'$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier"
flag.
(node:8368) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ...
to show where the warning was created)
Jetifier found 866 file(s) to forward-jetify. Using 6 workers...
info Starting JS server...
'adb' is not recognized as an internal or external command,
operable program or batch file.
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...
Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
- What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\jayde\Desktop\KYC\Zipcomply\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 38s
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.bat 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 location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\jayde\Desktop\KYC\Zipcomply\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 38s
at makeError (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\execa\index.js:174:9)
at C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\jayde\Desktop\KYC\Zipcomply\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.`
CodePudding user response:
ANDROID_HOME
is Deprecated (in Android Studio), use ANDROID_SDK_ROOT
instead.
Configure the ANDROID_SDK_ROOT
environment variable
- Open the Windows Control Panel.
- Click on User Accounts, then click User Accounts again
- Click on Change my environment variables
- Click on New... to create a new
ANDROID_SDK_ROOT
user variable that points to the path to your Android SDK:
The SDK is installed, by default, at the following location:
%LOCALAPPDATA%\Android\Sdk
You can find the actual location of the SDK in the Android Studio "Settings" dialog, under Appearance & Behavior → System Settings → Android SDK.
CodePudding user response:
Have you tried this?
Go to your React-native Project -> Android
Create a file local.properties
Paste
C:\Users\USERNAME\AppData\Local\Android\sdk
- Replace USERNAME with your user name