Gradle、Android 和 ANDROID_HOME SDK 位置

时间:2023-02-01
本文介绍了Gradle、Android 和 ANDROID_HOME SDK 位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

(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 位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:ViewModelProviders 在 1.1.0 中已弃用 下一篇:排除特定的构建变体

相关文章

最新文章