Version: 5.3
Troubleshooting Android development
Reporting crash bugs under Android

Inside the Android build process

The Android application build process has two steps:

  1. It generates the application package (.apk file) with all the required libraries and serialized Assets.

  2. The application package is deployed to the actual device.

Go to File > Build Settings… or File > Build & Run to open the Build Settings dialog box.

In the Build Settings dialog box, select Build And Run to perform both steps. Note that typing Cmd+B on your keyboard invokes this automatic build and run process, with the most recently used file as the build target.

If you select Build in the Build Settings dialog box, Unity only does step 1.

When you first try to build an Android project, you are asked the location of the Android SDK that is required to build and install your Android application on the device. You can change this setting later in via the Unity Preferences dialog box (menu: Unity > Preferences).

When you build your app to the Android device, check the USB Debugging and Allow mock locations checkboxes under Device Settings.

Run the adb devices command (which is in your Android SDK/platform-tools folder), so that the operating system can see your device. This works both for Mac and Windows.

Unity builds an application archive (.apk file) for you and installs it on the connected device.

NOTE: In some cases your application cannot automatically start (for example on iPhone), so you need to unlock the screen. In rare cases, you need to find the newly installed application in the menu.

Texture compression

In the Build Settings dialog box, there is a Texture Compression option. By default, Unity uses the ETC1/RGBA16 texture format for textures that don’t have individual texture format overrides (see Texture 2D / Per-Platform Overrides).

If you want to build an application archive (an .apk file) targeting a specific hardware architecture, use the Texture Compression option to override this default behavior. Any texture that is set to not be compressed is left alone; only textures using a compressed texture format use the format selected in the Texture Compression option.

To make sure the application is only deployed on devices which support the selected texture compression, Unity edits the AndroidManifest to include tags matching the particular format selected. This enables the Android Market filtering mechanism to only serve the application to devices with the appropriate graphics hardware.

Using Google Android project

To generates a project which can be opened by Android Studio, follow the steps below:

  1. Download Android Studio.
  2. Export the project from Unity with the Google Android project checkbox selected.
  3. Open Android Studio:
    • Go to File > Import Project. Choose a path (For example: If your project was exported to C:\MyProjects, pick C:\MyProjects\<Product Name\> path).
    • Pick Import Destination Folder
    • If it asks you to reload a project in the Language Level Changed dialog box, choose yes.

Notes: If you want to debug your application, you must set android:debuggable="true" in AndroidManifest.xml. Don’t forget to set it to false once you’re done.

Troubleshooting Android development
Reporting crash bugs under Android