Where does local.properties go for android project?
The local.properties
file goes in the project's root level, in the same folder as the gradlew
, gradlew.bat
, settings.gradle
and other files.
This file should not be included in source control. After (incorrectly) including this in source control, then deleting the file locally, Android Studio re-created the file for me automatically.
Here is the example content of this file:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# 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.
#Thu Aug 14 14:49:26 PDT 2014
sdk.dir=C\:\\Program Files (x86)\\Android\\android-studio\\sdk
Note the sdk.dir=
reference to the location of the Android Studio SDK installation (which may be different on different machines).
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable
Please follow the below steps:
- Go to your react-native Project then go to the android directory
Create a file with the 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
or (for newer versions of Android Studio / IntelliJ IDEA):
sdk.dir=C\:\\Users\\USERNAME\\AppData\\Local\\Android\\sdk
Where USERNAME your PC user name. Also, make sure the folder is sdk or Sdk.
Example:
sdk.dir=C:\\Users\\USERNAME\\AppData\\Local\\Android\\sdk
or:
sdk.dir=C\:\\Users\\USERNAME\\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 this doesn't work, add ANDROID_HOME variable in "Environment Variables" as C:\Users\USER\AppData\Local\Android\Sdk
Android: set sdk.dir in local.properties to ANDROID_HOME environment variable
local.properties should not be part of the versioned code. It's used as your local project configuration and Android Studio will create it based on on ANDROID_HOME
if it doesn't exist yet.
If local.properties is not available, Gradle will use ANDROID_HOME
automatically.
If local.properties is available, Gradle will use this file having a wrong sdk.dir
set and fail.
Related Topics
How to Get the Key from the Value in Firebase
Crop Video Before Encoding with Mediacodec for Grafika's "Continuous Capture" Activity
Android Studio 1.0.2 Not Building App:Mergedebugresources Error
Android Imageview's Onclicklistener Does Not Work
How to Get the File *.Apk Location in Android Device
Android Sdk Tools Revision 22 Issue
Application Content Goes Behind the Navigation Bar in Android L
Setsupportactionbar Toolbar Cannot Be Applied to (Android.Widget.Toolbar) Error
Android: Total Height of Scrollview
How to Detect "Recent Apps" System Button Clicks (Honeycomb+)
Android Volley Sending Data Twice
Android:Record Sound in Mp3 Format
How to Integrate Matlab Code Library with Android
Difference Between Android: and App: Prefix in Android Xml