I don’t know why but last weeks I found myself several times in a situation that I had to create Android builds in the Unity3D on new computers or reinstalled ones. Each time I had to execute the whole process of setting up Android SDK and mess with some issues as the installation is not straightforward as it should be. This article is kind of cheatsheet for me but maybe someone else also appreciate it.
First issue is that you can install Android SDK either as a part of Android Studio bundle or using SDK Tools and CLI. Since I don’t like to download and install big softwares just for one scenario, I was glad to found out that there is really quick CLI option to install SDK without much overhead.
Second issue is related to Unity 5.6.2p1 (and earlier versions) failing to build Android SDK Tools 26.0, so for time being only version 25 is supported by Unity.
1. JDK Installation
Download and install Java Development Kit as you can’t do much anything without it. Current version is 1.8.0.
2. Android SDK 25 Tools Installation
After download extract the content to your SDK path. In our case we will use
c:\Users\markey\AppData\Local\Android\SDK25\tools. Stop here for a while and take a notice that we created tools directory inside whole SDK directory. That is because
tools are just one package of the whole SDK and other packages will be installed on the same level.
3. Installing packages using CLI and SDKManager
As a next step we are going to startup CLI and open our newly created
cd c:\Users\markey\AppData\Local\Android\SDK25\tools\bin\Now try to list all your installed packages using sdkmanager command:
sdkmanager --listIt should output something like that:
Installed packages: Path | Version | Description | LocationU ------- | ------- | ------- | ------- tools | 25.2.5 | Android SDK Tools 25.2.5 | tools\ Available Packages: Path | Version | Description ------- | ------- | ------- ... add-ons;addon-g..._apis-google-24 | 1 | Google APIs ... build-tools;25.0.0 | 25.0.0 | Android SDK Build-Tools 25 build-tools;25.0.1 | 25.0.1 | Android SDK Build-Tools 25.0.1 build-tools;25.0.2 | 25.0.2 | Android SDK Build-Tools 25.0.2 build-tools;25.0.3 | 25.0.3 | Android SDK Build-Tools 25.0.3 build-tools;26.0.0 | 26.0.0 | Android SDK Build-Tools 26 ... platform-tools | 26.0.0 | Android SDK Platform-Tools ... platforms;android-25 | 3 | Android SDK Platform 25 platforms;android-26 | 1 | Android SDK Platform 26 ... tools | 26.0.2 | Android SDK Tools Available Updates: ID | Installed | Available ------- | ------- | ------- tools | 25.2.5 | 26.0.2As we can see
toolsare already installed, so we have to install three other packages
build-tools. The CLI command for that is
sdkmanager "package". If you like to explore
sdkmanagermore deeply then I recommend you to check out the documentation. For
build-toolswe have to specify proper version, so don’t forget to pick the one with version 25:
sdkmanager "platform-tools" sdkmanager "platforms;android-25" sdkmanager "build-tools;25.0.3"
4. Android paths setup in Unity
Go to the Unity and switch project to Android platform. Then open External Tools (see picture below) and set SDK path to
c:\Users\markey\AppData\Local\Android\SDK25\tools and also JDK path to where you installed it in the first step. In our case the path is
Now, try to build your project and voilà!