Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SDK not found for react-native

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.

like image 816
Xeizzeth Avatar asked Nov 18 '25 17:11

Xeizzeth


2 Answers

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

enter image description here

like image 117
Shi Quan Avatar answered Nov 20 '25 08:11

Shi Quan


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

like image 42
blackcub3s Avatar answered Nov 20 '25 08:11

blackcub3s



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!