Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does local.properties go for android project?

Getting this complaint from IntelliJ 13:

8:15:48 PM Gradle '<project>' project refresh failed:
           SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
           Build file '/<project>/build.gradle' line: 20
           : Gradle settings

I have tried to spam my local.properties in every directory I can think of but still getting this error. What gives?

like image 763
pfrank Avatar asked Dec 19 '13 04:12

pfrank


People also ask

Where is project properties in Android Studio?

You can create this file manually in project root directory, near other ". properties" files.

Where is Android gradle properties?

properties in the project folder or in the C:\Users\Username. gradle.

How do I set local properties?

Go to System Properties -> Environment Variables -> Add Variable -> put Variable Name and Value. Step 3. Add Variable name: ANDROID_HOME and value: as your SDK path. If your path is something else not in C Drive you have to add that.

What is local properties used for?

local. properties file is used to configure the properties which is used in project. if you hard code it, it would be a problem when you hand it over to client. instead you can put it in local.


2 Answers

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).

like image 123
CJBS Avatar answered Sep 22 '22 02:09

CJBS


For MAC create file local.properties inside android/ and paste this line inside the file

sdk.dir = /Users/USERNAME/Library/Android/sdk

like image 42
Tunvir Rahman Tusher Avatar answered Sep 19 '22 02:09

Tunvir Rahman Tusher