21

There are multiple similar questions everywhere across the internet and so far no provided solutions work.
I use Android Studio 4.0.0, and maybe this is the problem.

So far I got these settings in my system variables:
Environment variables

Also PATH variable:
PATH variable

Here is what react-native info outputs:

$ react-native info
info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.18363
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    Memory: 23.08 GB / 31.86 GB
  Binaries:
    Node: 12.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Version  4.0.0.0 AI-193.6911.18.40.6514223
  Languages:
    Java: 11.0.2 - /c/Users/zarifov/AppData/Local/jdk-11.0.2/bin/javac
    Python: 2.7.18 - /c/Python27/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: ~16.11.0 => 16.11.0
    react-native: ~0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

And also, just in case, react-native doctor output:

$ react-native doctor
Common
 ✓ Node.js
 ✓ yarn
 ✓ Python

Android
 ✓ JDK
 ✓ 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: 28.0.3
 ✓ ANDROID_HOME

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.
Common
 ✓ Node.js
 ✓ yarn
 ✓ Python

Android
 ✓ JDK
 ✓ 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: 28.0.3
 ✓ ANDROID_HOME

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.

Additional important information: The attempt to fix issue with SDK via doctor cannot be successful since it fails with "permission denied" on attempting to install Androd Command Line Tools despite the fact that the PowerShell and IDE are launched with admin privileges.

8
  • Did you try to redownload your sdk? Commented Jun 29, 2020 at 9:37
  • I just did. Right after your suggestion. No use. I'm almost certain that this is due to the wrong variables configuration. Commented Jun 29, 2020 at 10:39
  • checking through your post again, I cant see in the logs where it finds the URL for the sdk location, check if you actually have the sdk location assigned Commented Jun 29, 2020 at 10:44
  • ANDROID_SDK_HOME should also point to the SDK location I think, but at the moment its pointing to C:/Users/zarifov, make it the same as the ANDROID_HOME and ANDROID_SDK_ROOT Commented Jun 29, 2020 at 10:46
  • Actually SDK_HOME should point to the "default" location (in android terms), which is user's profile. It is said by android studio itself, once it coudn't launch even an emulator. And yes - it was set to the same location, before I changed it to the user profile. Commented Jun 29, 2020 at 10:49

13 Answers 13

61

I have a solution: install Android SDK Command-line Tools:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

AND add it to the path! On Windows with cmd shell: SET PATH=%PATH%;%ANDROID_HOME%\cmdline-tools\11.0\bin
This solution works !
17

The correct way of solving it involves a two-step process. This is what worked for me:

STEP 1

Install Android SDK Command-line tools. After doing so, once you call npx react-native doctor you'll no longer see Versions found: N/A (providing that you already have some SDK version(s) installed in your machine, which I assume is the case). After installing it you should see something like:

react-native doctor after installing Android SDK Command-line tools

STEP 2

If version found does not match the version react-native supports (version supported) then you need to download the correct SDK version to make them match. When doing so you need to be careful as you have to do two more steps within android studio menus: tools --> sdk manager --> Android SDK. Once here:

STEP 2.1 Select SDK Platforms and choose Platform and Sources for you API Level (tick "show package details" checkbox):

enter image description here

STEP 2.2 Select SDK Tools and tick the box of the API version you need to install to match it with react needs (again make sure you tick "show package details" checkbox):

enter image description here

Now click OK and install everything. Close your terminal and run it again. When using react-native doctor comand you'll find the problem is solved:

enter image description here

Comments

3

For me, after trying everything here, it just came down to my JAVA_HOME variable pointing to an old runtime. Updated it to the jdk-21 folder and now all is good.

Comments

2

Install Android SDK command line tool along with desired Android SDK build tool. Then check npx react-native doctor

Comments

2

TRY TO RESTART YOUR PC

It is working for me after more than 6 hours following dozens of solutions from the internet without trying this absolute killer solution. 😭

Make sure you have installed the same Android SDK version suggested in the react-native documentation.

Comments

1

You must install support libraries, you can do this by opening Android Studio, SDK manager and install support library version 28.0.3

enter image description here

enter image description here

3 Comments

The current situation with the build-tools: i.imgur.com/XKlYCX0.png
Maybe you need to install SDK platform too.
SDK platforms are also installed: i.imgur.com/GAZFjyF.png
1

I had this same issue. Mine was even showing that:

    Android
 ✓ JDK
 ✖ 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: 29.0.3
 ✓ ANDROID_HOME

Errors:   2
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.

enter image description here

I got fed up with all the steps that are online that are not working and just clicked on 'e'. It took its time and installed the said missing programs (note that I already installed Android studio and all the SDK instructions on react-native docs before now but for some reason it was not being detected)

When I ran npx react-native doctor, the issue was resolved:

enter image description here

1 Comment

Thank you for the reply. Although I'm no longer working on this project your reply is still appreciated since somebody still might stumble upon this issue and they could find your reply to be the solution.
0

I had exactly this problem and managed to solve it by doing something simple:

In the 'gradle-wrapper.properties' file, I changed the version of the gradle in distributionUrl value.

It was like that distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip and I changed to distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip.

Now it's working!!

1 Comment

It did not work for me. :(
0

Set up the env variables as given in this doc https://developer.android.com/tools

eg:

ANDROID_HOME=/home/ashish/Android/Sdk
PATH=$PATH:$ANDROID_HOME/platforms:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$ANDROID_HOME/tools/bin
export PATH

Comments

0

Add "C:\Users[USERNAME]\AppData\Local\Android\Sdk\cmdline-tools\latest\bin" to 'Path' of 'Environtment Variable'

then try to restart

open CMD then run sdkmanager "build-tools;28.0.3

Set System Environtment

Comments

0

%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin folder. all file error open each file. check this.

if !version! lss 170 if "%SKIP_JDK_VERSION_CHECK%" == "" ( echo Java version 17 or higher is required. echo To override this check set SKIP_JDK_VERSION_CHECK goto :eof )

if !version! lss 170. 170? edit 17. good work!!

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Install latest cmdline-tools and write the following into your .zshrc

export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

Comments

-2

i can see package deatils. its look lik thisenter image description here

1 Comment

Went ahead and made sure my installations mirror your configuration, then I went ahead some more and just installed all of them - no success in both cases.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.