Android:将local.properties中的sdk.dir设置为ANDROID_HOME环境变量 [英] Android: set sdk.dir in local.properties to ANDROID_HOME environment variable

查看:985
本文介绍了Android:将local.properties中的sdk.dir设置为ANDROID_HOME环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆