Issue
when I use this command in the terminal:
PS C:\web dev\practice-projects\react-native\myproject> react-native run-android --no-jetifier
I get this whole error:
info JS server already running.
'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, 1 stopped Daemon could not be reused, use --status for details
> Task :app:compileDebugJavaWithJavac FAILED
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.2/userguide/command_line_interface.html#sec:command_line_warning
14 actionable tasks: 2 executed, 12 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_271 contains a valid JDK installation.
* 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 39s
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.bat app:installDebug -PreactNativeDevServerPort=8081
My emulator isn't being launched and I have tried multiple fixes. I am getting started in react-native and don't understand the warnings or answers on similar questions. Please help.
Solution
There are few ways you can run your app,
- Always works - Open the app from android studio. Select
Open existing project
and selectandroid
folder in your app to open the project and run from there after indexing is done. - Not sure would work and not recommended (might need release build) but you can drag your apk file that is auto generated to your simulator to install.
- Add this line to
gradle.properties
file i.e.android/gradle.properties
.org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
. replace the jdk version name or directory if required.
Note for mac - this is not library folder
within your user directory so search them in your main drive location - should be something like machintosh hd
For windows - just replace the path after org.gradle.java.home=
. Should be something like C:\\Program Files\\Java\\jdk1.8.0_144
Answered By - Samin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.