brew cask install android-sdk
Posted
技术标签:
【中文标题】brew cask install android-sdk【英文标题】: 【发布时间】:2018-02-12 00:46:21 【问题描述】:我在 Mac OS X 上安装 android sdk (brew cask install android-idk
) 时遇到问题。
我试图为 nativescript 安装它。我读过有同样问题的人,但我找不到有效的解决方案。
我尝试更改 java 路径可能会导致问题。
这是我得到的错误:
==> Caveats
We will install android-sdk-tools, platform-tools, and build-tools for you.
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'
This operation may take up to 10 minutes depending on your internet connection.
Please, be patient.
==> Satisfying dependencies
==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
Already downloaded: /Users/jhon/Library/Caches/Homebrew/Cask/android-sdk--3859397,26.0.1.zip
==> Verifying checksum for Cask android-sdk
==> Installing Cask android-sdk
==> Warning: Failed to download any source lists!
==> Warning: java.nio.file.NoSuchFileException: /Users/jhon/.android/cache/sdkbin-1_b735609c-repository2-1_xml
==> Warning: Failed to find package tools
Error: Command failed to execute!
==> Failed command:
/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools/bin/sdkmanager tools platform-tools build-tools;26.0.1
==> Standard Output of failed command:
==> Standard Error of failed command:
jhon-MacBook-Pro-8:appNativescript jhon$ brew cask install android-idk --verbose --debug
Error: Cask 'android-idk' is unavailable: No Cask with this name exists.
Error: Install incomplete.
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:97:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:167:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:131:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
jhon-MacBook-Pro-8:appNativescript jhon$
==> Caveats
We will install android-sdk-tools, platform-tools, and build-tools for you.
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
'export ANDROID_SDK_ROOT=/usr/local/share/android-sdk'
This operation may take up to 10 minutes depending on your internet connection.
Please, be patient.
==> Satisfying dependencies
==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
Already downloaded: /Users/jhon/Library/Caches/Homebrew/Cask/android-sdk--3859397,26.0.1.zip
==> Verifying checksum for Cask android-sdk
==> Installing Cask android-sdk
==> Warning: Failed to download any source lists!
==> Warning: java.nio.file.NoSuchFileException: /Users/jhon/.android/cache/sdkbin-1_b735609c-repository2-1_xml
==> Warning: Failed to find package tools
Error: Command failed to execute!
==> Failed command:
/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools/bin/sdkmanager tools platform-tools build-tools;26.0.1
==> Standard Output of failed command:
==> Standard Error of failed command:
Warning: Failed to download any source lists!
Warning: java.nio.file.NoSuchFileException: /Users/jhon/.android/cache/sdkbin-1_b735609c-repository2-1_xml
Warning: Failed to find package tools
==> Exit status of failed command:
#<Process::Status: pid 35477 exit 1>
Error: Install incomplete.
jhon-MacBook-Pro-8:appNatives
【问题讨论】:
【参考方案1】:这是文档所说的,您可以尝试一下-
解决方案 1 -
安装 Android 开发的依赖项。
安装 JDK 8 或更高的稳定官方版本。
转到 Java SE 下载并单击 JDK 下载。 在 Java SE 开发工具包部分,接受许可协议并单击 Mac macOS 的下载链接。 等待下载完成并安装 JDK。 设置 JAVA_HOME 系统环境变量。 导出 JAVA_HOME=$(/usr/libexec/java_home) 安装 Android SDK。在Terminal
中运行以下命令:
brew cask install android-sdk
接下来,运行以下命令设置ANDROID_HOME
系统环境变量:
export ANDROID_HOME=/usr/local/share/android-sdk
注意:这是包含工具和平台工具目录的目录。 此外,安装适用于 Android SDK Platform 25、Android SDK Build-Tools 25.0.2 或更高版本、Android Support Repository、Google Repository 和您可能需要的任何其他 SDK 的所有软件包。您也可以使用以下命令,它将安装所有必需的包。
$ANDROID_HOME/tools/bin/sdkmanager
"tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository" 按照此处的文章设置 Android 模拟器 (AVD)
或
解决方案 2
下载 Android Studio 并更新 API 级别并支持 repos 就是这样 - 对我来说一直有效 Android SDK
【讨论】:
下载Android Studio后如何设置命令行工具? 需要更多信息吗?没听懂你在说什么?以上是关于brew cask install android-sdk的主要内容,如果未能解决你的问题,请参考以下文章
Mac的brew和brew cask区别以及安装brew cask
Mac软件安装 homebrew & brew cask使用技巧