Unity 3D Game Engine – Build – Android – Windows OS

There are some steps you must follow before you can build and run any code on your Android device.

Tested on Unity 4.3f – Win 7 64 bit – Android 4.2

1. Java JDK

Install Java JDK, if you have JRE is not enought!

This is because if you want to run Java programs, but not develop them, download the Java Runtime Environment, or JRETM, if you want to develop applications for Java, download the Java Development Kit, or JDKTM. The JDK includes the JRE, so you do not have to download both separately.

You need Java JDK 6 – Windows x86 (not 64 bit becuase Unity 4.x is a 32 bit software) or over from here:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. Android SDK

2. Download the Android SDK from:
https://developer.android.com/sdk/index.html#ExistingIDE

It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development.

a. Unzip the ZIP file and copy it wherever you want, example c:\adt-bundle-windows-x86-

NOTICE: YOU HAVE NOT TO RENAME OR MOVE THE FOLDER AFTER UNZIP IT OR YOU WILL GET AN ERROR!

b. Run SDK Manager to complete the installation, this will take a lot of minutes.

c. Installing the SDK be sure to add at least one Android platform with API level equal to or higher than 9 (Platform 2.3 or greater), the Platform Tools, and the USB drivers if you’re using Windows

– If the Android device is automatically recognized by the system you still might need to update the drivers with the ones that came with the Android SDK. This is done through the Windows Device Manager.

– If the device is not recognized automatically use the drivers from the Android SDK, or any specific drivers provided by the manufacturer. Additional info can be found here: http://developer.android.com/sdk/win-usb.html

— use the Android SDK Manager tool that is included with the Android SDK.
— Launch the Android SDK Manager by double-clicking SDK Manager.exe, at the root of your SDK directory.
— Expand Extras
— Check Google USB Driver package and click Install
— Proceed to install the package.
When done, the driver files are downloaded into the \extras\google\usb_driver\ directory

—————————–
OR YOU CAN USE ANDROID STUDIO
—————————–

2. Android Studio

2. Download the Android Studio Bundle from:
http://developer.android.com/sdk/installing/studio.html#Updating

a. Launch the downloaded EXE file, android-studio-bundle-.exe

b. In step 4 of Installing the SDK be sure to add at least one Android platform with API level equal to or higher than 9 (Platform 2.3 or greater), the Platform Tools, and the USB drivers if you’re using Windows.

– If the Android device is automatically recognized by the system you still might need to update the drivers with the ones that came with the Android SDK. This is done through the Windows Device Manager.

– If the device is not recognized automatically use the drivers from the Android SDK, or any specific drivers provided by the manufacturer. Additional info can be found here: http://developer.android.com/sdk/win-usb.html

It will be installed at:
Windows: \Users\\AppData\Local\Android\android-studio\sdk\

c. Setup Windows variables

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.

3. Android Device

a. Turn on “USB Debugging” on your device.
Go to Settings -> Developer options, then enable USB debugging. As of Android Jelly Bean 4.2 the Developer options are hidden by default. To enable them tap on Settings -> About Phone -> Build Version multiple times. Then you will be able to access the Settings -> Developer options.

b. Install drivers

– Connect your Android-powered device to your computer’s USB port.
– Right-click on Computer from your desktop or Windows Explorer, and select Manage.
– Select Devices in the left pane.
– Locate and expand Other device in the right pane.
– Right-click the device name (such as Nexus S) and select Update Driver Software. This will launch the Hardware Update Wizard.
– Select Browse my computer for driver software and click Next.
– Click Browse and locate the USB driver folder. (The Google USB Driver is located in \extras\google\usb_driver\.)
– Click Next to install the driver.

4. Unity

Unity will ask to locate the folder where you installed the Android SDK, setup at:
Unity MAIN TOP MENU > Edit> Preferences> External Tools> Android SDK Location

MAIN TOP MENU> File> Buil Settings…> Platform> Android> ‘Switch platform’

MAIN TOP MENU> File> Buil Settings…> ‘Player Settings’> Inspector> setup parameters

MAIN TOP MENU> File> Buil Settings…> ‘Build’

Official Unity docs:
https://docs.unity3d.com/Documentation/Manual/android-sdksetup.html