How to run and debug a Unity3D game on Android from Windows
Install the Android SDK
The Android S
it will be needed for Unity to build for Android.
You can get the SDK here:
Install the SDK
and then point Unity to the SDK path
. From the top menu Unity > Preferences > External Tools. There you'll find the Android SDK path.
USB Debugging / Developer Mode
First you need to get your phone into developer mode. This is done from the settings but it can get criptic. In Android 4.4 you have to go to Settings > About Phone and tap on the Build Number 7 times until you get a message that you are now a developer.
If this fails go search: "How to get ANDROID_VERSION into developer mode"
Once your device is in dev mode you will have a developers section in the settings where you can enabled USB Debugging.
Run the ADB
The Android Debug Bridge ( abd.exe ) is under the Android SDK platform-tools folder.
To use it first open up the command prompt in administrator mode
(Start > Search Programs and Files > cmd.exe * Right click > Run as Admin).
Navigate to your android SDK platform tools directory.
For me this was
> cd C:\Program Files (x86)\Android\android-sdk\platform-tools
Before we start please note:
To end a process that is still running press ctrl + c
The folder you are in contains adb.exe so you can enter the command:
> abd devices
This will list the devices connected to your computer. If the list is empty continue, if not you can skip to step 5
Start gathering log data
If your device is showing up on the list of devices you can now start gather data. Run the command:
> adb logcat -s Unity > logfile.txt
This will gather all the data from the device and store it in the file. It is important at you run cmd as an Administrator otherwise you may not be able to generate a file in certain secure directories of Windows, like /Program Files.
Specifying Unity in the logcat will filter our messages specific to Unity.
That is all . Run your game on the phone and see the errors pop up in the log. The log file will be created in the same folder the adb.exe file is located in.
Your game isn't on the device??
If you haven't deployed your game to the device here's how:
Build a version of your project for Android using the Unity Build Settings.
Once you have an .apk file you need to transfer it to your device via USB. Simple copy / paste job will sufice.
Finally get yourself a file manager app. I use Android File Manager. This will let you browser the files on your device. Navigate to your .apk and install it.
You game will now show up amongst your apps as if installed from the store.