Legacy Documentation: Version 5.4
Android Remote (DEPRECATED)
Inside the Android build process

Troubleshooting Android development

“No Platforms Found” error:

  1. Uninstall the current Android SDK and make sure that you don’t have more than one copy of it.
  2. Update Java with a stable version. Bear in mind the latest version shouldn’t have conflicts, but users have experienced problems in the past.
  3. Download a fresh copy of the latest ADT Bundle and install it following the instructions. This should configure the development tools correctly: http://developer.android.com/sdk/index.html
  4. Configure Unity with the installed Android SDK.

Unity fails to install your application to your device

  1. Verify that your computer can actually see and communicate with the device. See the Publishing Builds page for further details.
  2. Check the error message in the Unity console. This will often help diagnose the problem.

If you get an error saying “Unable to install APK, protocol failure” during a build then this indicates that the device is connected to a low-power USB port (perhaps a port on a keyboard or other peripheral). If this happens, try connecting the device to a USB port on the computer itself.

Your application crashes immediately after launch.

  1. Ensure that you are not trying to use NativeActivity with devices that do not support it.
  2. Try removing any native plugins you have.
  3. Try disabling stripping.
  4. Use adb logcat to get the crash report from your device.

Building DEX Failed

This is an error which will produce a message similar to the following:-

Building DEX Failed!
G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M 
-Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" 
-jar "G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/dx.jar" 
--dex --verbose --output=bin/classes.dex bin/classes.jar plugins
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


This is usually caused by having the wrong version of Java installed on your machine. Updating your Java installation to the latest version will generally solve this issue.

The game crashes after a couple of seconds when playing video

Make sure Settings->Developer Options->Don’t keep activities isn’t enabled on the phone. The video player is its own activity and therefore the regular game activity will be destroyed if the video player is activated.

My game quits when I press the sleep button

Change the activity tag in the AndroidManifest.xml to contain android:configChanges tag as described here.

An example activity tag might look something like this:-

<activity android:name=".AdMobTestActivity"
                  android:label="@string/app_name"
                  android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


Android Remote (DEPRECATED)
Inside the Android build process