React-native Error: Make sure you have the Android development environment set up [Solved]

The error message is as follows

Run gradlew tasks to get a list of available tasks. 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.

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

Error source: my RN code from the company’s computer clone is normal, and the above errors occur in yarn install and yarn Android, both in virtual machine running and real machine running. In order to try and error, I init a project again, and the result is such an error, but I can still run individual RN projects, of course.

Consult the document solution 1:
just start it directly with Android studio and let Android studio automatically integrate some Android environments and then run applications. However, I personally gave up because I was not very proficient in as running Android, but I thought it would be troublesome if I needed to run as every time I created an RN project

Solution 2:
the blogger said that it is necessary to configure the ADB environment. After a review, it is found that almost all the configured Android environments have been configured

%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\emulator
%ANDROID_HOME%\tools
%ANDROID_HOME%\tools\bin

Document review solution 3:

Place the following line in your Android/gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true

What do bloggers mean when they post the above sentence?In fact, the support community is messy. Google launched Android X and gradually shifted its focus and migrated, so our project depends on the package and needs to be migrated
Android. Useandroidx = true indicates that androidx is enabled for the current project. Android. Enablejetifier = true indicates that dependent packages will also be migrated to androidx. If the value is false, it means that the dependent package will not be migrated, but there may be problems when using the content in the dependent package. Of course, if no three-party dependency is used in my project, this item can be set to false
in fact, these two pieces of code were already there when we created the RN project

Solution 4 (feasible):
in fact, I just saw that the blogger posted several strings of English, one of which was

# npx react-native doctor

I knew that the NPX react native doctor command should be similar to the fluent doctor command. Check whether the current running environment meets the requirements

So I ran the command on the command line. I found that the doctor told me that I lacked the java8 environment (in fact, I do have it, but he said that I must lack it) and Android tools 29.2. So I uninstalled java8, reinstalled and reconfigured Java_ Home go to as to download 29.2
just come back and check it again


Read More: