Getting - Version supported: Not Found for Android SDK
I'm trying @react-native-community/cli doctor with yarn-workspaces. I've installed expo-yarn-workspaces in my project which should link my common dependencies from top level node_modules. When I'm running npx @react-native-community/cli doctor command I'm getting following output. Am I missing something here?
npx @react-native-community/cli doctor Common ✓ Node.js ✓ yarn ✓ Watchman - Used for watching changes in the filesystem when in development mode
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: 28.0.3, 29.0.2
- Version supported: Not Found ✓ ANDROID_HOME
iOS ✓ Xcode - Required for building and installing your app on iOS ✓ CocoaPods - Required for installing iOS dependencies ✓ ios-deploy - Required for installing your app on a physical device with the CLI
Errors: 1 Warnings: 0
I had the same problem on Windows using Powershell but it was fixed by simply moving into a project directory. The minimum SDK version needed seems to be defined in our project's android/build.gradle file.
@pdallair what do you mean by a project directory? If i'm just in the installation process, so there is no directory yet
TL;DR — project directory = directory that was specified and created when you ran npx react-native init <project_dir>.
Basically...
@tiavina-mika I believe I was following these reactnative.dev setup instructions on Windows for Android app dev at the time.
After following the requirements installation instructions, we get to the "Creating a new application" segment. Where the first thing we are instructed to do is to...
create a new React Native project called "AwesomeProject" by running...
npx react-native init AwesomeProject
This should create the directory and generate all the files needed for a very basic mobile application inside it.
Later down in the article, in the "Running your React Native application" section we are instructed to run some more npx commands...
inside your React Native project folder
Although the article doesn't mention npx react-native doctor, it also needs to be run from inside the relevant project directory in order to get accurate results.
More unnecessary info...
You should be inside your project directory for the 2 following reasons:
You probably don't have a "permanent/global" react-native command installed.
When you run the following syntax npx <command> [command-args], by default, npx will look for the command specified in your $PATH and ./node_modules/.bin. If npx can't find the command, it will prompt you to install the command specified. Although it isn't mentioned, this installation by npx is temporary.
However, In our case, if I'm not mistaken, the react-native command with the init argument makes a permanent installation of itself and plenty of other commands inside <project_dir>/node_modules/.bin directory. So, npx will be able to find the command specified if you're inside <project_dir>.
For a "permanent/global" command installation you can use npm install -g react-native though I don't know if this is a good practice. I'm still a beginner at this but I imagine there are reasons why the "official" guide I was following didn't mention this.
The "Versions Supported" info is project-specific.
npx react-native doctor probably looks for the Android SDK "Versions Supported" info in ./android/build.gradle generated when you first ran npx react-native init <project_dir>. So, if you're not inside <project_dir> when you run npx react-native doctor it simply won't be able to find what it's looking for: hence the Version supported: Not Found message in OPs output.
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.