Legacy Documentation: Version 5.2
Troubleshooting Android development
Reporting crash bugs under Android

Inside the Android Build Process

The Android application build process is performed in two steps:

  1. Application package (.apk file) is generated with all the required libraries and serialized assets.
  2. Application package is deployed on the actual device.

When “Build” is hit on “Build settings” dialog only the first step is accomplished. Hitting “Build and Run” performs both steps. If Cmd+B is hit then the automatic build and run process is invoked and the latest used file is assumed as the build target.

Upon the first attempt to build an Android project, Unity would ask you to locate the Android SDK, that is required to build and install your Android application on the device. You can change this setting later in Preferences.

When building the app to the Android, be sure that the device has the “USB Debugging” and the “Allow mock locations” checkboxes checked in the device settings.

You can ensure that the operating system sees your device by running adb devices command found in your Android SDK/platform-tools folder. This should work both for Mac and Windows.

Unity builds an application archive (.apk file) for you and installs it on the connected device. In some cases your application cannot autostart like on iPhone, so you need to unlock the screen, and in some rare cases find the newly installed application in the menu.

Texture Compression

Under Build Settings you’ll also find the Texture Compression option. By default, Unity uses 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 (.apk file) targeting a specific hardware architecture, you can use the Texture Compression option to override this default behavior. Any texture that is set to not be compressed will be left alone; only textures using a compressed texture format will 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 will edit the AndroidManifest to include tags matching the particular format selected. This will enable the Android Market filtering mechanism to only serve the application to devices with the appropriate graphics hardware.

Google Android Project

Generates a project which can be opened by Android Studio. Simply follow the steps:

  • Download Android Studio.
  • Export the project from Unity with Google Android project checkbox selected.
  • Open Android Studio:
    • File->Import Project. For ex., if you project was exported to C:\MyProjects, pick C:\MyProjects<Product Name> path.
    • Pick Import Destination Folder
    • Finish
    • If it asks you to reload a project in Language Level Changed dialog, choose yes.
    • Note: 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.
  • Done
Troubleshooting Android development
Reporting crash bugs under Android
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961