While developing for Android using Unity, you could encounter a number of issues. Problems are often related to plug-ins or incorrect Project settings. This section outlines the most common scenarios and relavant troubleshooting advice.
Remove any native plug-ins you have.
adb logcat to get the crash report from your device. Consult the official Android Developer Logcat Command-Line Tool documentation for more information.
Ensure Settings > Developer Options > Don’t keep activities isn’t enabled on the device.
The video player is its own activity, and therefore regular game activity will be destroyed if the video player is activated.
If Unity cannot find an Android device connected to the system, check the following:
Make sure that your device is actually connected to your computer - check the USB cable and the sockets.
Make sure that your device has USB Debugging enabled in the Developer options. For more details, refer to the Android SDK/NDK Setup page.
adb devices command from the
platform-tools directory of your Android SDK installation and check the output.
If the output list is empty and you are using Windows, you may need to install the driver for ADB devices. For more details, refer to the Android SDK/NDK Setup documentation.
If the list contains entries with the unauthorized label, you may need to authorize your computer on your device and give it permission to debug it. Check the device’s screen for the corresponding dialog.
If the list contains your device with the device label, build your Project in Unity again.
This error occurs when the Android Asset Packaging Tool (AAPT) fails. AAPT is used to build the intermediate Asset packages during Android build. This issue is most often caused by missing resources or duplicate resources in your Android plug-ins.
Check the console message for more details - it should contain the IDs of the resources that are missing or duplicates. Fix the error in your plug-ins by either adding the missing resources/settings or removing the duplicate plug-ins.
The most likely cause for this issue is that one of your plug-ins has a manifest that is incompatible with the main Unity manifest.
Check the console message for more details on which attributes are conflicting, and fix the manifests accordingly.
See the Android Manifest documentation for more details on Android manifests.
The most likely cause for this issue is that you have a Java plug-in added twice. This results in duplicate classes when Unity tries to build a DEX (Dalvik Executable Format) file from all the compiled Java plug-ins. Check the console output for the list of duplicate entries, and fix the plug-ins.
If your console messages says “Too many references”, it means that the number of fields and methods exceeded the DEX limit of 64k. This usually happens when the number of plug-ins or plug-in resources is too high. Due to the way the references are generated, the limit could be hit with just a couple of large plug-ins.
There are several ways to handle this issue. One of these is by stripping the plug-ins. However, the quickest way to fix it is to switch to the Gradle build system, or export the Project and build it in Android Studio.
This error can be caused by:
Installing to an incompatible device.
Installing to a device running a version of Android lower than the Minimum API Level in your Player settings.
Check the console for the actual error code and output.
2017–05–25 Page published with editorial review
Updated functionality in 5.5