简体   繁体   English

如何离线下载Android SDK组件?

[英]How to download Android SDK components offline?

I am using latest version of (android-studio-bundle-135.1740770-windows 7) 我正在使用(android-studio-bundle-135.1740770-windows 7)的最新版本

I have completed the installation process, but when I open the Android SDK it says "downloading components". 我已经完成了安装过程,但是当我打开Android SDK时显示“正在下载组件”。 I let it download, but the download fails with this error: 我让它下载,但下载失败并出现以下错误:

  ****// Refresh Sources:
  Failed to fetch URL 

  (http://dl.google.com/android/repository/addons_list-2.xml), reason: Unknown Host dl.google.com
  Fetched Add-ons List successfully
  Refresh Sources
  Failed to fetch URL 
  http://dl.google.com/android/repository/repository-10.xml, reason: IO Unknown Host dl.google.com
  There is nothing to install or update.
  The following SDK component was not installed: 
  build-tools-21.1.1 ***///

I found a solution from Google for downloading these components offline using a direct link to the repository, but the repository contains lots of files. 我从Google找到了一种解决方案,可以使用直接链接到资源库的离线方式下载这些组件,但是资源库中包含许多文件。 Which files do I want to download? 我要下载哪些文件?

Adding SDK Packages: 添加SDK软件包:

By default, the Android SDK does not include everything you need to start developing. 默认情况下,Android SDK不包含开始开发所需的一切。 The SDK separates tools, platforms, and other components into packages you can download as needed using the Android SDK Manager. SDK将工具,平台和其他组件分离为可通过Android SDK Manager根据需要下载的软件包。 So before you can start, there are a few packages you should add to your Android SDK. 因此,在开始之前,应将一些软件包添加到Android SDK中。

To start adding packages, launch the Android SDK Manager in one of the following ways: 要开始添加软件包,请通过以下方式之一启动Android SDK Manager:

In Android Studio, click SDK Manager in the toolbar.
If you're not using Android Studio:
    Windows: Double-click the SDK Manager.exe file at the root of the Android SDK directory.
    Mac/Linux: Open a terminal and navigate to the tools/ directory in the location where the Android SDK was installed, then execute android sdk.

When you open the SDK Manager for the first time, several packages are selected by default. 首次打开SDK Manager时,默认情况下会选择多个软件包。 Leave these selected, but be sure you have everything you need to get started by following these steps: 使这些保持选中状态,但是请确保您具备执行以下步骤所需的一切:

  1. Get the latest SDK tools 获取最新的SDK工具

    As a minimum when setting up the Android SDK, you should download the latest tools and Android platform: Open the Tools directory and select: Android SDK Tools Android SDK Platform-tools Android SDK Build-tools (highest version) Open the first Android XX folder (the latest version) and select: SDK Platform A system image for the emulator, such as ARM EABI v7a System Image 作为设置Android SDK的最低要求,您应该下载最新的工具和Android平台:打开Tools目录,然后选择:Android SDK Tools Android SDK Platform-tools Android SDK Build-tools(最高版本)打开第一个Android XX文件夹(最新版本),然后选择:SDK Platform仿真器的系统映像,例如ARM EABI v7a系统映像。

  2. Get the support library for additional APIs 获取其他API的支持库

    The support library is required for: Android Wear Android TV Google Cast 支持库对于以下设备是必需的:Android Wear Android TV Google Cast

    It also provides these popular APIs: Navigation drawer Swipe views Backward-compatible action bar 它还提供了以下流行的API:导航抽屉滑动视图向后兼容的操作栏

    The Android Support Library provides an extended set of APIs that are compatible with most versions of Android. Android支持库提供了一组扩展的API,这些API与大多数Android版本兼容。

  3. Open the Extras directory and select: Android Support Repository Android Support Library 打开Extras目录,然后选择:Android支持存储库Android支持库

  4. Get Google Play services for even more APIs 获得Google Play服务以获取更多API

    The Google Play services APIs provide a variety of features and services for your Android apps, such as: User authentication Google Maps Google Cast Games achievements and leaderboards And much more Google Play服务API为您的Android应用程序提供了多种功能和服务,例如:用户身份验证Google Maps Google Cast游戏成就和排行榜等等

  5. To develop with Google APIs, you need the Google Play services package: 要使用Google API进行开发,您需要使用Google Play服务软件包:

    Open the Extras directory and select: Google Repository Google Play services 打开Extras目录,然后选择:Google Repository Google Play服务

    Note: Google Play services APIs are not available on all Android-powered devices, but are available on all devices with Google Play Store. 注意:Google Play服务API并非在所有支持Android的设备上都可用,但在所有装有Google Play商店的设备上都可用。 To use these APIs in the Android emulator, you must also install the the Google APIs system image from the latest Android XX directory in the SDK Manager. 要在Android模拟器中使用这些API,您还必须从SDK Manager中最新的Android XX目录安装Google API系统映像。

  6. Install the packages 安装软件包

    Once you've selected all the desired packages, continue to install: Click Install X packages. 选择所有需要的软件包后,继续安装:单击“安装X软件包”。 In the next window, double-click each package name on the left to accept the license agreement for each. 在下一个窗口中,双击左侧的每个程序包名称以接受每个程序包的许可协议。 Click Install. 单击安装。

    The download progress is shown at the bottom of the SDK Manager window. 下载进度显示在SDK Manager窗口的底部。 Do not exit the SDK Manager or it will cancel the download. 不要退出SDK Manager,否则它将取消下载。

  7. Build something! 建立东西!

    With the above packages now in your Android SDK, you're ready to build apps for Android. 现在,借助Android SDK中的上述软件包,您就可以为Android构建应用了。 As new tools and other APIs become available, simply launch the SDK Manager to download the new packages for your SDK. 随着新工具和其他API的推出,只需启动SDK Manager即可为您的SDK下载新软件包。

    While this is the step outlined in the Andriod developer site, it outlines the basic tools needed to get started... 尽管这是Andriod开发人员网站中概述的步骤,但它概述了入门所需的基本工具...

HOPE IT HELPS! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM