There are two Android build process output types in Unity: the output package (APK) and the exported project. An APK is automatically deployed to your device if you select Build and Run. Alternatively, you can use Android Debug Bridge (ADB) to deploy the APK manually after building. For the full list of ADB commands, refer to the Android Debug Bridge section of the Android Developer documentation.
The output package includes APK expansion files (OBB) if the Split Application Binary option is selected in the Unity Editor’s Player Settings window. For more details on OBB files, refer to the OBB Support section of the Unity Manual
Unity supports two Android build systems: Gradle and Internal. Unity exports projects in two formats: ADT (Google Android project) and Gradle.
The Internal build system creates an APK by invoking Android SDK utilities in a specific order. Unity automatically performs a number of steps to create the APK, including:
Preparing and building the Unity Assets
Compiling scripts
Processing the plug-ins
Splitting the resources into the parts that go to the APK and the OBB, if Split Application Binary is selected
Building the Android resources using the AAPT utility
Generating the Android manifest and merging the library manifests into it
Compiling the Java code into the Dalvik Executable format (DEX)
Building the IL2CPP library, if IL2CPP Scripting Backend is selected
Building and optimizing the APK and OBB packages
For more information about OBB files, see Unity documentation on OBB Support. For more information about the Android Manifest, see Unity Android Manifest documentation.
The Gradle build system uses Gradle to build an APK or export a project in Gradle format, which can then be imported to Android Studio. For more details, see Unity documentation on Gradle for Android.
When you select this build system, Unity goes through the same steps as the Internal build system excluding resource compilation with AAPT and running DEX. Unity then generates the build.gradle file (along with the other required configuration files) and invokes the Gradle executable, passing it the task name and the working directory. The APK is then built by Gradle.
For more control over the build pipeline, or to make changes that Unity does not normally allow (for example, fine tuning the manifest files that are automatically generated by Unity), you must export your project for use with external tools.
Unity supports exporting projects in two formats:
Gradle project - Gradle projects are the recommended export format when exporting into Android Studio.
Google Android project (also known as ADT or Eclipse projects) - ADT projects can be imported into Eclipse or Android Studio (importing into Android converts the project to Gradle). This format is outdated and is no longer supported by Google.
To export the project:
Select Gradle or ADT in the Build Settings window (and check the Export Project checkbox if you have selected Gradle).
Click Export and select the destination folder.
When the export has finished, open Android Studio and import your project. For more information on importing projects to Android Studio, refer to the Migrate to Android Studio section of the Android Developer documentation.
In the Build Settings window, there is a Texture Compression option. By default, Unity uses the ETC texture format for textures that don’t have individual texture format overrides (see Unity documentaton on Textures for more information).
When building an APK to target specific hardware architecture, use the Texture Compression option to override this default behavior. Any texture that is not set to 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 app is only deployed on devices which support the selected texture compression, Unity edits the Android Manifest to include tags that match the particular format selected. This ensures that the Google Play Store filtering mechanism will only serve the app to devices with appropriate graphics hardware.
The Build Settings window offers two options: Build and Build and Run. When building, the output packages (APK and OBB, if enabled) are saved to the path that you select. You can publish these packages to the Google Play Store, or install them on your device manually with the help of ADB . For further information about installing apps manually, refer to the Running Your App section of the Android Developer documentation.
Selecting Build and Run saves the output packages to the file path you specify, while also installing your app on the Android device connected to your computer.
If the Split Application Binary option is enabled, the OBB file is pushed to the correct location on your device. If Development Build is checked, Unity also sets up a profiler tunnel and enables CheckJNI. After that, the app is launched.
Tip: Once you specify the output path for the packages, use the Ctrl+B (Windows) or Cmd+B (OSX) keyboard shortcut to Build and Run using the saved output path.
2017–05–25 Page published with editorial review
Updated functionality in 5.5
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.