- SDK Manager
- Recommended Packages
- Adding New Sites
- Troubleshooting
- Installing the Android SDK
- Setting up the Android SDK for Xamarin.Android
- Overview
- Requirements
- SDK Manager
- Android SDK location
- Tools tab
- Platforms tab
- Repository selection
- Requirements
- SDK Manager
- Locations tab
- Tools tab
- Platforms tab
- Repository selection
- Summary
SDK Manager
The Android SDK separates tools, platforms, and other components into packages you can download using the SDK Manager. For example, when the SDK Tools are updated or a new version of the Android platform is released, you can use the SDK Manager to quickly download them to your environment.
You can launch the SDK Manager in one of the following ways:
- From Eclipse (with ADT), select Window >Android SDK Manager.
- From Android Studio, select Tools >Android >SDK Manager.
- On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
- On Mac or Linux, open a terminal and navigate to the tools/ directory in the location where the Android SDK is installed, then execute android sdk .
You can select which packages you want to download by toggling the checkboxes on the left, then click Install to install the selected packages.
Figure 1. The Android SDK Manager shows the SDK packages that are available, already installed, or for which an update is available.
There are several different packages available for the Android SDK. The table below describes most of the available packages and where they’re located in your SDK directory once you download them.
Recommended Packages
Here’s an outline of the packages required and those we recommend you use:
SDK Tools Required. Your new SDK installation already has the latest version. Make sure you keep this up to date. SDK Platform-tools Required. You must install this package when you install the SDK for the first time. SDK Platform Required.You must download at least one platform into your environment so you’re able to compile your application. In order to provide the best user experience on the latest devices, we recommend that you use the latest platform version as your build target. You’ll still be able to run your app on older versions, but you must build against the latest version in order to use new features when running on devices with the latest version of Android.
To get started, download the latest Android version, plus the lowest version you plan to support (we recommend Android 2.2 for your lowest version).
System Image Recommended. Although you might have one or more Android-powered devices on which to test your app, it’s unlikely you have a device for every version of Android your app supports. It’s a good practice to download system images for all versions of Android your app supports and test your app running on them with the Android emulator. Android Support Recommended. Includes a static library that allows you to use some of the latest Android APIs (such as fragments, plus others not included in the framework at all) on devices running a platform version as old as Android 1.6. All of the activity templates available when creating a new project with the ADT Plugin require this. For more information, read Support Library. SDK Samples Recommended. The samples give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. Note that multiple samples packages are available — one for each Android platform version. When you are choosing a samples package to download, select the one whose API Level matches the API Level of the Android platform that you plan to use.
Tip: For easy access to the SDK tools from a command line, add the location of the SDK’s tools/ and platform-tools to your PATH environment variable.
The above list is not comprehensive and you can add new sites to download additional packages from third-parties.
In some cases, an SDK package may require a specific minimum revision of another package or SDK tool. The development tools will notify you with warnings if there is dependency that you need to address. The Android SDK Manager also enforces dependencies by requiring that you download any packages that are needed by those you have selected.
Adding New Sites
By default, Available Packages displays packages available from the Android Repository and Third party Add-ons. You can add other sites that host their own Android SDK add-ons, then download the SDK add-ons from those sites.
For example, a mobile carrier or device manufacturer might offer additional API libraries that are supported by their own Android-powered devices. In order to develop using their libraries, you must install their Android SDK add-on, if it’s not already available under Third party Add-ons.
If a carrier or device manufacturer has hosted an SDK add-on repository file on their web site, follow these steps to add their site to the Android SDK Manager:
- Select Available Packages in the left panel.
- Click Add Add-on Site and enter the URL of the repository.xml file. Click OK.
Any SDK packages available from the site will now be listed under a new item named User Add-ons.
Troubleshooting
Problems connecting to the SDK repository
If you are using the Android SDK Manager to download packages and are encountering connection problems, try connecting over http, rather than https. To switch the protocol used by the Android SDK Manager, follow these steps:
Источник
Installing the Android SDK
Android Studio provides everything you need to start developing apps for Android, including the Android Studio IDE and the Android SDK tools.
If you didn’t download Android Studio, go download Android Studio now, or switch to the stand-alone SDK Tools install instructions.
Before you set up Android Studio, be sure you have installed JDK 6 or higher (the JRE alone is not sufficient)—JDK 7 is required when developing for Android 5.0 and higher. To check if you have JDK installed (and which version), open a terminal and type javac -version . If the JDK is not available or the version is lower than 6, go download JDK.
To set up Android Studio on Windows:
- Launch the .exe file you just downloaded.
- Follow the setup wizard to install Android Studio and any necessary SDK tools.
On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location.
Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21 .
The individual tools and other SDK packages are saved outside the Android Studio application directory. If you need to access the tools directly, use a terminal to navigate to the location where they are installed. For example:
To set up Android Studio on Mac OSX:
- Unzip the downloaded zip file, android-studio-ide- -mac.zip .
- Drag and drop Android Studio into the Applications folder.
- Open Android Studio and follow the setup wizard to install any necessary SDK tools.
Depending on your security settings, when you attempt to open Android Studio, you might see a warning that says the package is damaged and should be moved to the trash. If this happens, go to System Preferences > Security & Privacy and under Allow applications downloaded from, select Anywhere. Then open Android Studio again.
The individual tools and other SDK packages are saved outside the Android Studio application directory. If you need access the tools directly, use a terminal to navigate into the location where they are installed. For example:
To set up Android Studio on Linux:
- Unpack the downloaded Tar file, android-studio-ide- -linux.zip , into an appropriate location for your applications.
- To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh .
You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.
If the SDK is not already installed, follow the setup wizard to install the SDK and any necessary SDK tools.
Note: You may also need to install the ia32-libs, lib32ncurses5-dev, and lib32stdc++6 packages. These packages are required to support 32-bit apps on a 64-bit machine.
Android Studio is now ready and loaded with the Android developer tools, but there are still a couple packages you should add to make your Android SDK complete.
The stand-alone SDK Tools package does not include a complete Android development environment. It includes only the core SDK tools, which you can access from a command line or with a plugin for your favorite IDE (if available).
If you didn’t download the SDK tools, go download the SDK now, or switch to the Android Studio install instructions.
To get started on Windows:
Your download package is an executable file that starts an installer. The installer checks your machine for required tools, such as the proper Java SE Development Kit (JDK) and installs it if necessary. The installer then saves the Android SDK Tools to a specified the location outside of the Android Studio directories.
- Double-click the executable ( .exe file) to start the install.
- Make a note of the name and location where you save the SDK on your system—you will need to refer to the SDK directory later when using the SDK tools from the command line.
- Once the installation completes, the installer starts the Android SDK Manager.
To get started on Mac OSX:
Unpack the ZIP file you’ve downloaded. By default, it’s unpacked into a directory named android-sdk-mac_x86 . Move it to an appropriate location on your machine, such as a «Development» directory in your home directory.
Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later when using the SDK tools from the command line.
To get started on Linux:
Unpack the .zip file you’ve downloaded. The SDK files are download separately to a user-specified directory.
Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later when using the SDK tools from the command line.
Troubleshooting Ubuntu
- If you need help installing and configuring Java on your development machine, you might find these resources helpful:
- https://help.ubuntu.com/community/Java
- https://help.ubuntu.com/community/JavaInstallation
- Here are the steps to install Java:
-
If you are running a 64-bit distribution on your development machine, you need to install additional packages first. For Ubuntu 13.10 (Saucy Salamander) and above, install the libncurses5:i386 , libstdc++6:i386 , and zlib1g:i386 packages using apt-get :
For earlier versions of Ubuntu, install the ia32-libs package using apt-get :
The Android SDK tools are now ready to begin developing apps, but there are still a couple packages you should add to make your Android SDK complete.
Then, select which SDK bundle you want to install:
Источник
Setting up the Android SDK for Xamarin.Android
Visual Studio includes an Android SDK Manager that you use to download Android SDK tools, platforms, and other components that you need for developing Xamarin.Android apps.
Overview
This guide explains how to use the Xamarin Android SDK Manager in Visual Studio and Visual Studio for Mac.
This guide applies to Visual Studio 2019, Visual Studio 2017, and Visual Studio for Mac.
The Xamarin Android SDK Manager (installed as part of the Mobile development with .NET workload) helps you download the latest Android components that you need for developing your Xamarin.Android app. It replaces Google’s standalone SDK Manager, which has been deprecated.
Requirements
To use the Xamarin Android SDK Manager, you will need the following:
Visual Studio 2019 Community, Professional, or Enterprise.
OR Visual Studio 2017 (Community, Professional, or Enterprise edition). Visual Studio 2017 version 15.7 or later is required.
Visual Studio Tools for Xamarin version 4.10.0 or later (installed as part of the Mobile development with .NET workload).
The Xamarin Android SDK Manager also requires the Java Development Kit (which is automatically installed with Xamarin.Android). There are several JDK alternatives to choose from:
By default, Xamarin.Android uses JDK 8, which is required if you are developing for API level 24 or greater (JDK 8 also supports API levels earlier than 24).
You can continue to use JDK 7 if you are developing specifically for API level 23 or earlier.
If you are using Visual Studio 15.8 Preview 5 or later, you can try using Microsoft’s Mobile OpenJDK Distribution rather than JDK 8.
Xamarin.Android does not support JDK 9.
SDK Manager
To start the SDK Manager in Visual Studio, click Tools > Android > Android SDK Manager:
The Android SDK Manager opens in the Android SDKs and Tools screen. This screen has two tabs – Platforms and Tools:
The Android SDKs and Tools screen is described in more detail in the following sections.
Android SDK location
The Android SDK location is configured at the top of the Android SDKs and Tools screen, as seen in the previous screenshot. This location must be configured correctly before the Platforms and Tools tabs will function properly. You may need to set the location of the Android SDK for one or more of the following reasons:
The Android SDK Manager was unable to locate the Android SDK.
You have installed the Android SDK in a alternate (non-default) location.
To set the location of the Android SDK, click the ellipsis (…) button to the far right of Android SDK Location. This opens the Browse For Folder dialog to use for navigating to the location of the Android SDK. In the following screenshot, the Android SDK under Program Files (x86)\Android is being selected:
When you click OK, the SDK Manager will manage the Android SDK that is installed at the selected location.
Tools tab
The Tools tab displays a list of tools and extras. Use this tab to install the Android SDK tools, platform tools, and build tools. Also, you can install the Android Emulator, the low-level debugger (LLDB), the NDK, HAXM acceleration, and Google Play libraries.
For example, to download the Google Android Emulator package, click the check mark next to Android Emulator and click the Apply Changes button:
A dialog may be shown with the message, The following package requires that you accept its license terms before installing:
Click Accept if you accept the Terms and Conditions. At the bottom of the window, a progress bar indicates download and installation progress. After the installation completes, the Tools tab will show that the selected tools and extras were installed.
Platforms tab
The Platforms tab displays a list of platform SDK versions along with other resources (like system images) for each platform:
This screen lists the Android version (such as Android 8.0), the code name (Oreo), the API level (such as 26), and the sizes of the components for that platform (such as 1 GB). You use the Platforms tab to install components for the Android API level that you want to target. For more information about Android versions and API levels, see Understanding Android API Levels.
When all components of a platform are installed, a checkmark appears next to the platform name. If not all components of a platform are installed, the box for that platform is filled. You can expand a platform to see its components (and which components are installed) by clicking the + box to the left of the platform. Click — to unexpand the component listing for a platform.
To add another platform to the SDK, click the box next to the platform until the checkmark appears to install all of its components, then click Apply Changes:
To install only specific components, click the box next to the platform once. You can then select any individual components that you need:
Notice that the number of components to install appears next to the Apply Changes button. After you click the Apply Changes button, you will see the License Acceptance screen as shown earlier. Click Accept if you accept the Terms and Conditions. You may see this dialog more than one time when there are multiple components to install. At the bottom of the window, a progress bar will indicate download and installation progress. When the download and installation process completes (this can take many minutes, depending on how many components need to be downloaded), the added components are marked with a checkmark and listed as Installed.
Repository selection
By default, the Android SDK Manager downloads platform components and tools from a Microsoft-managed repository. If you need access to experimental alpha/beta platforms and tools that are not yet available in the Microsoft repository, you can switch the SDK Manager to use Google’s repository. To make this switch, click the gear icon in the lower right-hand corner and select Repository > Google (Unsupported):
When the Google repository is selected, additional packages may appear in the Platforms tab that were not available previously. (In the above screenshot, Android SDK Platform 28 was added by switching to the Google repository.) Keep in mind that use of the Google repository is unsupported and is therefore not recommended for everyday development.
To switch back to the supported repository of platforms and tools, click Microsoft (Recommended). This restores the list of packages and tools to the default selection.
Requirements
To use the Xamarin Android SDK Manager, you will need the following:
- Visual Studio for Mac 7.5 (or later).
The Xamarin Android SDK Manager also requires the Java Development Kit (which is automatically installed with Xamarin.Android). There are several JDK alternatives to choose from:
By default, Xamarin.Android uses JDK 8, which is required if you are developing for API level 24 or greater (JDK 8 also supports API levels earlier than 24).
You can continue to use JDK 7 if you are developing specifically for API level 23 or earlier.
If you are using Visual Studio for Mac 7.7 or later, you can try using Microsoft’s Mobile OpenJDK Distribution rather than JDK 8.
Xamarin.Android does not support JDK 9.
SDK Manager
To start the SDK Manager in Visual Studio for Mac, click Tools > SDK Manager:
The Android SDK Manager opens in the Preferences window, which contains three tabs, Platforms, Tools, and Locations:
The tabs of the Android SDK Manager are described in the following sections.
Locations tab
The Locations tab has three settings for configuring the locations of the Android SDK, Android NDK, and the Java SDK (JDK). These locations must be configured correctly before the Platforms and Tools tabs will function properly.
When the SDK Manager starts, it automatically determines the path for each installed package and indicates that it was Found by placing a green checkmark icon next to the path:
Click the Reset to Defaults button to cause the SDK Manager to look for the SDK, NDK, and JDK at their default locations.
Typically, you use the Locations tab to modify the location of the Android SDK and/or the Java JDK. You do not need to install the NDK to develop Xamarin.Android apps – the NDK is used only when you need to develop parts of your app using native-code languages such as C and C++.
Tools tab
The Tools tab displays a list of tools and extras. Use this tab to install the Android SDK tools, platform tools, and build tools. Also, you can install the Android Emulator, the low-level debugger (LLDB), the NDK, HAXM acceleration, and Google Play libraries.
For example, to download the Google Android Emulator package, click the check mark next to Android Emulator and click the Apply Changes button:
A dialog may be shown with the message, The following package requires that you accept its license terms before installing:
Click Accept if you accept the Terms and Conditions. At the bottom of the window, a progress bar indicates download and installation progress. After the installation completes, the Tools tab will show that the selected tools and extras were installed.
Platforms tab
The Platforms tab displays a list of platform SDK versions along with other resources (like system images) for each platform:
This screen lists the Android version (such as Android 8.1), the code name (Oreo), the API level (such as 27), and the sizes of the components for that platform (such as 1 GB). You use the Platforms tab to install components for the Android API level that you want to target. For more information about Android versions and API levels, see Understanding Android API Levels.
When all components of a platform are installed, a checkmark appears next to the platform name. If not all components of a platform are installed, the box for that platform is filled. You can expand a platform to see its components (and which components are installed) by clicking the arrow to the left of the platform. Click down arrow to unexpand the component listing for a platform.
To add another platform to the SDK, click the box next to the platform until the checkmark appears to install all of its components, then click Apply Changes:
To install only some components, click the box next to the platform once. You can then select any individual components that you need:
Notice that the number of components to install appears next to the Apply Changes button. After you click the Apply Changes button, you will see the License Acceptance screen as shown earlier. Click Accept if you accept the Terms and Conditions. You may see this dialog more than one time when there are multiple components to install. At the bottom of the window, a progress bar will indicate download and installation progress. When the download and installation process completes (this can take many minutes, depending on how many components need to be downloaded), the added components are marked with a checkmark and listed as Installed.
Repository selection
By default, the Android SDK Manager downloads platform components and tools from a Microsoft-managed repository. If you need access to experimental alpha/beta platforms and tools that are not yet available in the Microsoft repository, you can switch the SDK Manager to use Google’s repository. To make this switch, click the gear icon in the lower right-hand corner and select Repository > Google (Unsupported):
When the Google repository is selected, additional packages may appear in the Platforms tab that were not available previously. (In the above screenshot, Android SDK Platform 28 was added by switching to the Google repository.) Keep in mind that use of the Google repository is unsupported and is therefore not recommended for everyday development.
To switch back to the supported repository of platforms and tools, click Microsoft (Recommended). This restores the list of packages and tools to the default selection.
Summary
This guide explained how to install and use the Xamarin Android SDK Manager tool in Visual Studio and Visual Studio for Mac.
Источник
-