skip to Main Content

I’m new to React Native and I’m having trouble getting started with my first project. I’ve followed the installation steps for React Native, including setting up Java, Android Studio, and the related SDK files. I’ve also configured the necessary environment variables for Android as shown in the attached images.

Despite following all the installation steps, I’m encountering an issue when trying to initialize a new React Native project. It’s not working as expected, I’m encountering an issue while setting up a React Native project. When I run npx react-native doctor, I receive the following error message:

Error:

error Failed to install the app.
PS D:Visual Studio CodeProjectsReact NativeAwesomeProject> npx react-native doctor
Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ yarn - Required to install NPM dependencies

Android
 ✓ Adb - Required to verify if the android device is attached correctly
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 33.0.0
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation

Errors:   1
Warnings: 0

Usage
 › Press f to try to fix issues.
 › Press e to try to fix errors.
 › Press w to try to fix warnings.
 › Press Enter to exit.

It appears that the Android SDK is not being detected, even though I have Android Studio installed. Here are the steps I’ve taken to resolve the issue:

  1. Installed Android Studio and confirmed that it includes the Android SDK.
  2. Set the ANDROID_HOME environment variable to the correct path.
  3. Added the platform-tools subdirectory of the Android SDK to my system’s PATH variable.
  4. Checked and confirmed that the Android SDK components corresponding to version 33.0.0 are installed using the SDK Manager in Android Studio.

Despite these steps, I’m still encountering the error. Can someone please help me troubleshoot and resolve this issue? Any guidance or insights would be greatly appreciated.

Operating System: Windows
Android Studio Version: 2022.3.1.19
React Native Version: 0.72.4

Image from editor
SDK platforms
SDK Tools
Environment Variable
System Variable

I want a relevant solution to resolve this issue

2

Answers


  1. try this:

    cd android

    chmod +x gradlew

    ./gradlew clean

    then run your app

    Login or Signup to reply.
  2. Just now I have been solving this error since the morning, I reinstalled the corresponding version of JAVA since I ran the sdk manager --list command and got the following error: Error: LinkageError occurred while loading main class com.android.sdklib .tool.sdkmanager.SdkManagerCli java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 I changed it again in the environment variables and for some reason it worked.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search