Unity - Testing on Android

Contents

About

Unity is cross-platform game engine and authoring tool. This page represents my own personal notes on how to publish from Unity on a Mac onto an Android for testing. It assumes you've already downloaded Unity and created a project with one scene (any project will do).

Once downloaded, unzip the file, move the folder to /Developer/adt-bundle-mac-x86_64-20140702 and follow the instructions that appear to install it. These instructions are:

#1 Go into into the /eclipse subdirectory and launch Eclipse.

#2 Click the little "STD Manager" icon (Android with tie) in the toolbar.

#3 Select all of Tools, all of the latest Android x.xx, then down the bottom you may also like "Android Support Repository", "Android Support Library", "Google Repository", "Google Play Services"... then click "Install X Packages". You may need to click this button a few times and waiting for the downloads might take a while.

Also note: this "Android STK Manager" is a little tricky, you may want to just tick a few boxes at a time, and when the pop-up appears, individually click them and click "Accept" in the "Accept License" doesn't just accept everything. Depending on download speeds, this might take you over 30 minutes or so for everything.

Copy /Developer/adt-bundle-mac-x86_64-20140702/sdk/build-tools/19.1.0/zipalign to ../sdk/tools/zipalign. (this is a bug that took me a while to work out - Android must have changed this file location and Unity hasn't been updated to the new location yet)

On your Android phone or tablet click: Settings > About Phone, then hit the "Build number" (down the bottom) many times to enable developer mode. Now go Settings > Developer and enable "USB Debugging" (this allows you to directly upload new programs).

Connect your Android to your mac (into a USB slot).

Back in Unity click: File > Build Settings, select the Android tab, select "Development Build" and then click "Player Settings…". In the Inspector window, expand "Other Settings" you may as well chose a later Android min Android version and for "Bundle Id" enter something like "com.myproject.mygame". You should now be able to hit "Build and Run"… and if your Android is still plugged in, the application will appear and automatically open on your mobile. During the build process it will prompt you to tell it the location of the android "sdk" folder, which you've installed at: "/Developer/adt-bundle-mac-x86_64-20140702/std".

Being able to directly upload your program to your phone is fantastic for rapid testing. If you're at the stage where you want others to test your app, this is even easier as you don't need your phone connected. Instead of "Build and Run" hit "Build" and save out a "ProgramName.apk" then email it to yourself or friends as an attachment (or upload to Google drive or a website if you prefer). Open this email on your Android phone and click the attachment... you'll have to change "Settings > Security > Unknown sources" to on - and you may have to enable the developer (as before), then it will install the app on any phone (without needing to attach any USB).