运行`tns platform add android`时找不到兼容的Android SDK进行编译 [英] Cannot find a compatible Android SDK for compilation when running `tns platform add android`

查看:81
本文介绍了运行`tns platform add android`时找不到兼容的Android SDK进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循官方的NativeScript 教程,并且在配置OS X环境以进行android开发时遇到了问题.

I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.

运行tns platform add android时,出现以下错误:

When running tns platform add android I receive the following error:

找不到兼容的Android SDK进行编译.为了能够针对Android进行构建,请安装Android SDK 21或更高版本.

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.

tns doctor命令还会针对android-sdk问题返回警告:

The tns doctor command also returns warnings on android-sdk issues:

找不到兼容的Android SDK进行编译.有能力去 为Android构建,安装Android SDK 21或更高版本.运行$ android来 管理您的Android SDK版本.您需要拥有Android SDK 系统上安装的构建工具.您必须安装版本22. 从命令行运行"android"以安装所需的Android Build 工具.您需要拥有最新的Android支持存储库 安装在您的系统上.运行$ android来管理Android 支持存储库.

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later. Run $ android to manage your Android SDK versions. You need to have the Android SDK Build-tools installed on your system. You have to install version 22. Run "android" from your command-line to install required Android Build Tools. You need to have the latest Android Support Repository installed on your system. Run $ android to manage the Android Support Repository.

我的android-sdk安装如下:

My android-sdk installation looks like this:

我的.bash_profile还包括以下内容:

My .bash_profile also includes the followings:

export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"

export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"

我应该进一步尝试设置系统范围的环境变量-不仅是.bash_profile吗?另外,可能是我在设置过程中错过了一些东西...

Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...

关于如何调试这种情况(命令,配置文件等)的任何技巧都将非常有用,谢谢!

Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!

推荐答案

好的,因此您需要确定以下几点:

Alright, so you need to make sure of following:

  • 确保已安装API 22.
  • 确保已安装Android SDK Build Tools22.x.x. (是的, 特别是22.x.x)
  • 确保已安装Android支持存储库. (你可以 在Android SDK Manager的其他"部分下找到它)
  • Make sure you have API 22 installed.
  • Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes, specifically 22.x.x)
  • Make sure you have Android support repository installed. (You can find it under Extras section in Android SDK Manager)

执行完上述步骤后,再次运行tns doctor,您应该会看到No issues were detected消息.

Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.

这篇关于运行`tns platform add android`时找不到兼容的Android SDK进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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