Unity build systems: internal vs gradle

Gradle is build system which automates a number of build processes. This automation means that many common build errors are less likely to occur. Most notably in Unity, it reduces the method reference count in DEX (Dalvik Executable format) files, meaning that you are less likely to come across DEX limit problems. However, due to the differences between Gradle and the default Unity Android build system, some existing projects may be hard to convert to Gradle.

You can either build the output package (APK) using the Gradle build system in Unity, or export the Gradle project and build it in an external tool (such as Android Studio).

To learn more, see Gradle’s resources on Getting Started with Gradle for Android Build. Internal Build is old system that used by unity technology to build the apk file 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.


One recent and very major difference since Unity 2019.1.0b1 is that the internal build system is no longer supported!

Android: Remove internal build system


The Internal(Default) is used to build and even run your Unity Project on Android from the Editor. This can be done with the Build And Run button.


The Gradle(New) option gives you extra option to export your Unity project into Android Studio project if the Export Project option is checked. The Export Project option can only be checked when Gradle(New) is selected. Gradle(New) option is mostly useful for the Android platform only.

Another advantage of Gradle(New) is that it allows you to specify your own gradle file to build your Unity Project. Just name the gradle file "mainTemplate.gradle" and put it in the <ProjectName>Assets\Plugins\Android directory.

In the old days, to use gradle file in your build, you must export the Unity Project as Android Project then use a third party software like Android Studio or Eclipse to add gradle support to your app. The Gradle(New) made that easier. You can now do that without exporting the project at-all with the Gradle(New) option.

Tags:

Unity3D