Android:将local.properties中的sdk.dir设置为ANDROID_HOME环境变量 [英] Android: set sdk.dir in local.properties to ANDROID_HOME environment variable
问题描述
因此,local.properties
文件在sdk.dir
变量中包含对Android SDK目录的引用.对我来说是sdk.dir=/Users/rajkiran/Library/Android/sdk
.在我的CI计算机上,sdk.dir
指向SDK目录,该目录指向无效的位置,因为用户名不同.
So the local.properties
file holds the reference to the Android SDK directory in sdk.dir
variable. For me it is sdk.dir=/Users/rajkiran/Library/Android/sdk
. On my CI machine, the sdk.dir
refers to the SDK directory which points to an invalid location since the username is different.
有什么办法可以将SDK目录设置为我的ANDROID_HOME
吗?
Is there any way so that I can set SDK directory as my ANDROID_HOME
?
也许是这样的:sdk.dir=$ANDROID_HOME
,以便在我的CI机器上,它将通过环境变量设置SDK目录?
Perhaps something like this: sdk.dir=$ANDROID_HOME
, so that on my CI machine, it will set the SDK directory from the environment variable?
推荐答案
local.properties 应该不成为版本化代码的一部分.它用作您的本地项目配置,如果还不存在,Android Studio将基于ANDROID_HOME
创建它.
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.
如果 local.properties 不可用,Gradle将自动使用ANDROID_HOME
.
If local.properties is not available, Gradle will use ANDROID_HOME
automatically.
如果 local.properties 可用,则Gradle将使用设置了错误sdk.dir
的该文件,然后失败.
If local.properties is available, Gradle will use this file having a wrong sdk.dir
set and fail.
这篇关于Android:将local.properties中的sdk.dir设置为ANDROID_HOME环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!