Configure Android SDK for Unity
This is quick guide to all things you need to do before start Unity Android development. I gathered there things that I was always looking for and didn't found on Unity documentation. From step where those instructions would double you'll be pointed to proper documentation page.
1. Download and install JDK
If you want to develop for Android you will need to install Java and set environment variables.
Open the Oracle website and download newest JDK.
On the next view choose your version (Windows?):
Then click through Java installer.
>>> More on this blog: How to organize Unity project directories?
2. Setup Java environment variables
For Android / Unity purposes its only required to set up PATH
variable. To do this you can install useful program called Patheditor. Otherwise, you can google how to setup PATH
environment variable.
If you would like to setup other environment variables for Java here are the examples:
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_112
JDK_HOME : %JAVA_HOME%
JRE_HOME : %JAVA_HOME%\jre
CLASSPATH : %JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
PATH : other-entries;%JAVA_HOME%\bin
Make sure that PATH
doesn't contain references to another Java installation directory.
3. Download Android SDK.
Go to the bottom of the website and find Get just the command line tools section. We don't need Android Studio here. Choose command line tools like on the image below:
Unzip this to desired SDK location.
4. Install SDK components
Now we need to install Android components. We are not using Android Studio so we will need to run console.
To install those things we will use console tool called 'sdkmanager.bat'. It is inside \tools\bin\
directory of [Your AndroidSDK location]
— in my example it was directly in custom folder on C:
drive.
If you would like to check newest packages versions simply run sdkmanager.bat --list
command.
To run scripts in *.bat
you need to enter command line. To do this get into [AndroidSDK]\tools\bin\
and in directory bar write cmd
like on gif below:
Don't rely on versions below — those was newest while I was writing this tutorial.
Install required packages like this:
sdkmanager.bat platforms;android-27
sdkmanager.bat platform-tools
sdkmanager.bat build-tools;27.0.1
sdkmanager.bat extras;google;usb_driver
6. Setup locations in Unity
Go to Edit/Preferences/External tools
and setup paths according to locations you have choosen:
That's it. Now you can proceed with steps from Unity documentation. From third step or so.
>>> More on this blog: Why VS Code is the best IDE for Unity dev. What extensions are great?
... a few steps further. You are ready to become Unity Android Developer! Take a look below for even better start.