問題描述
(2016 年 8 月)
這個問題來自 2013 年 11 月(當時 Android Studio 仍處于開發者預覽模式),
That question is from November 2013 (while Android Studio was still in Developer Preview mode),
目前(AS v2.2,2016 年 8 月)在安裝期間,AS 要求選擇 SDK 文件夾(或默認安裝),它會自動應用于您打開的任何項目.
Currently (AS v2.2, Aug-2016) during instalation AS asks to choose the SDK folder (or install on their default) and it automatically applies to which ever project you're opening.
這意味著任何可能的解決方法或修復都無關緊要,因為該問題不再可重現.
That means any possible workaround or fix is irrelevant as the issue is not reproducible anymore.
原始問題:
我們有這個項目,其中包含幾個模塊,這些模塊已經使用包裝器在另一臺開發人員 PC 上進行了配置和正確執行.我將完整的 git 子模塊克隆到我的機器中.
we have this project with several modules that is already configured and executes correctly on another developer PC using a wrapper. I cloned the complete git submodules into my machine.
下面是我的命令行的直接打印:
Below it's a directly print of my command line:
$ ./gradlew
FAILURE: Build failed with an exception.
* Where:
Build file '/home/budius/project_name/ActionBar-PullToRefresh/library/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':ActionBar-PullToRefresh:library'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.378 secs
$ echo $ANDROID_HOME
/home/budius/Applications/android-studio/sdk
$
所以,你可以看到 ANDROID_HOME 在那里.他們還想要什么?這里有什么問題.
so, as you can see the ANDROID_HOME is there. What else do they want? What's wrong here.
在 Ubuntu 13.04 上運行
running on Ubuntu 13.04
我已經在項目根目錄上創建了一個帶有 sdk.dir=<path>
的 local.properties 文件,它可以工作.但這使得代碼更難跨系統 n 構建服務器移植,所以問題仍然存在.
I already created a local.properties file with sdk.dir=<path>
on the project root and it works. But that makes the code harder to port across systems n build server, so the question is still open.
有人知道為什么 ANDROID_HOME 不工作以及如何使它工作嗎?
Anyone knows why the ANDROID_HOME is not working and what to do to make it work?
推薦答案
這個問題是從 2013 年 11 月開始的(當時 Android Studio 還處于開發者預覽模式),
That question is from November 2013 (while Android Studio was still in Developer Preview mode),
目前(AS v2.2,2016 年 8 月)在安裝期間,AS 要求選擇 SDK 文件夾(或默認安裝),它會自動應用于您打開的任何項目.
Currently (AS v2.2, Aug-2016) during instalation AS asks to choose the SDK folder (or install on their default) and it automatically applies to which ever project you're opening.
這意味著任何可能的解決方法或修復都無關緊要,因為該問題不再可重現.
That means any possible workaround or fix is irrelevant as the issue is not reproducible anymore.
這篇關于Gradle、Android 和 ANDROID_HOME SDK 位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!