android 项目的 local.properties 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20673378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where does local.properties go for android project?
提问by pfrank
Getting this complaint from IntelliJ 13:
从 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?
我试图在我能想到的每个目录中向我的 local.properties 发送垃圾邮件,但仍然收到此错误。是什么赋予了?
回答by CJBS
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.
该local.properties
文件也要在项目的根目录中,在同一个文件夹中gradlew
,gradlew.bat
,settings.gradle
和其他文件。
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.
此文件不应包含在源代码管理中。在(错误地)将其包含在源代码管理中之后,然后在本地删除该文件后,Android Studio 会自动为我重新创建该文件。
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.dir=
Android Studio SDK安装位置的引用(在不同机器上可能会有所不同)。
回答by Tunvir Rahman Tusher
For MAC
create file local.properties
inside android/
and pastethis line inside the file
对于MAC
创建的文件local.properties
中android/
,并粘贴在文件中这一行
sdk.dir = /Users/USERNAME/Library/Android/sdk
sdk.dir = /Users/USERNAME/Library/Android/sdk