Android Studio未安装SDK ...什么? [英] Android Studio doesn't install SDKs... what?
问题描述
我正在尝试使用Cordova来构建一个hello world应用程序,并在添加ANDROID_HOME
变量后(花了多长时间才弄明白了)我在构建时一直看到的是这样的:
I'm trying to use Cordova to build a hello world app and after adding ANDROID_HOME
variable (You'd be shocked how long that took to figure out) all I keep seeing when building is this:
建立失败
总时间:1分钟6.679秒错误: /用户/vladdy/桌面/实验室/cordovaBackgroundApp/平台/android/gradlew: 命令失败,退出代码为1错误输出:
Total time: 1 mins 6.679 secs Error: /Users/vladdy/Desktop/laboratory/cordovaBackgroundApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
失败:构建失败 有一个例外.
FAILURE: Build failed with an exception.
-
出了什么问题:配置根项目"android"时出现问题.
What went wrong: A problem occurred configuring root project 'android'.
在/Users/vladdy/Library/Android/sdk中找不到带有哈希字符串'android-25'的目标
Failed to find target with hash string 'android-25' in: /Users/vladdy/Library/Android/sdk
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
确定得还可以,让我们开始安装它:
Ok fair enough so let's go install it:
耐心等待安装,并且运行cordova build
时出现相同错误.
Waiting patiently for the install, and same error running cordova build
.
我想知道我们还需要安装什么?但是看起来Android Studio似乎仍然有Nougat和25种可用:
I wonder what else we need to install? But look, it seems that Android Studio still has Nougat and 25 available:
我明白了为什么PhoneGap Build如此受欢迎...
I can see why PhoneGap Build is so popular...
cordova requirements
现在已损坏,报告以下内容:
cordova requirements
is now broken reporting the following:
我的~/.bash_profile
:
export ANDROID_HOME=/Users/vladdy/Library/Android/sdk/
推荐答案
要求?
如果您不需要Android Studio,建议不要下载它,就像@ Tom-Esendam也建议的那样,请使用命令行工具.
Requirements?
If you don't need Android Studio, I recommend not downloading it, instead, as @Tom-Esendam also suggest, go for the command-line tool.
OSX命令行工具的直接下载链接 (2017-03-21)
Direct download link of Command Line Tool for OSX (2017-03-21)
如果您位于代理服务器后面,请不要忘记将其添加到"SDK管理器设置"中的设置中.
And if your behind a proxy server, don't forget to add it to the settings in the SDK Manager Settings.
cordova build
不下载任何SDK.
cordova prepare
将必要的SDK文件附加到cordova构建文件夹中.
cordova prepare
appends the necessary SDK files to the cordova build folders.
解压缩后,将ANDROID_HOME
设置为它的根目录,这样就可以:
After unzipping it, set ANDROID_HOME
to it's root, so you have:
- 构建工具
- 附加
- 平台
- 平台工具
- 系统映像
- 工具
根目录下的目录.
然后使用./tools/android
安装SDK.
Android SDK Manager会下载SDK,因此您只需check
所需的内容,然后按OK
即可下载.
Then install SDK's with ./tools/android
.
Android SDK Manager downloads the SDK's, so you check
what you need and hit OK
to download it.
- 如果您位于代理之后,请确保已设置所有代理设置.
- 在运行
cordova build
之前,先运行cordova prepare
.这不是必须的,但至少我需要运行,即使您cordova build
也应该包含它.
- Make sure all proxy settings are set if your behind a proxy.
- Before running
cordova build
runcordova prepare
. This shouldn't be necessary, but least I need to run that even thoucordova build
should include that.
这篇关于Android Studio未安装SDK ...什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!