SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable
Please follow below steps it work's for me:
- Go to your react-native Project then go to android directory
Create a file with following name:
local.properties
- Open the file and paste your Android SDK path like below:
For windows users:
sdk.dir=C:\\Users\\UserName\\AppData\\Local\\Android\\sdk
Replace UserName with your pc user name . Also make sure the folder is sdk or Sdk. In my case my computer user name is Zahid so the path look like:
sdk.dir=C:\\Users\\Zahid\\AppData\\Local\\Android\\sdk
For Mac users:
sdk.dir = /Users/USERNAME/Library/Android/sdk
Where USERNAME is your OSX username.
For Linux (Ubuntu) users:
sdk.dir = /home/USERNAME/Android/Sdk
Where USERNAME is your linux username(Linux paths are case-sensitive: make sure the case of S
in Sdk
matches)
In case if this doesn't work, add ANDROID_HOME variable in "Environment Variables" as C:\Users\USER\AppData\Local\Android\Sdk
React Native CLI Android installation error
Assuming that you already have the Android SDK installed, you need to create a file named local.properties
at the root of you Android project your-react-native-project-android/
and you should also add it to .gitignore if you are using git.
The file must indicate the path of the SDK on your computer, for macOS for example
local.properties
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Oct 26 14:02:40 CEST 2021
sdk.dir=/Users/username/Library/Android/sdk
If you never installed the SDK, you need to start here
Related Topics
Webview Shouldinterceptrequest Example
Listview with Onitemclicklistener
How to Apply a Style to All Buttons of an Android Application
How to Create Turn-By-Turn Gps Navigation App on Android/iOS Using Google Maps
How to Turn Off 3G/Data Programmatically on Android
How to Make a Scroll Listener for Webview in Android
Voice Recognition on Android with Recorded Sound Clip
How to Hide the System Bar in Android 3.0? It's an Internal Device and I'm Managing Navigation
Deleting Android Sms Programmatically
How to Save a Bitmap on Internal Storage
Android Appcompat 21 Elevation
Prevent Dialog Dismissal on Screen Rotation in Android
Android Studio Gradle Configuration with Name 'Default' Not Found