Build for Android 11 with Unity
Stay organized with collections
Save and categorize content based on your preferences.
To support Android 11 (API level 30), the package visibility
<queries>
element was added to ARCore Extensions for AR Foundation (1.19 or later).
When using these versions of ARCore, the <queries>
element requires Gradle version
5.6.4 or later.
In most cases, using the Android Gradle plugin version 3.6.0 is
sufficient. To confirm compatibility between the Android Gradle plugin and the
Gradle version you are using, consult the Android Gradle plugin
compatibility table.
Unity gradle support
Instructions for supported versions of Unity are listed in the following
sections.
For more information see these articles:
Unity 2021 and later
All versions of Unity 2021 support targeting Android 11. Refer to Unity's 2021
Gradle for Android
documentation for detailed version information. To summarize:
Unity 2021.1 up to and including 2021.1.15f1 ship with Gradle 5.6.4 or later
(and Gradle plugin 3.6.0 or later). No action is required.
Unity 2021.1.16f1 and later ship with Gradle 6.1.1 or later (and
Gradle plugin 4.0.1 or later). No action is required.
Unity 2020
All versions of Unity 2020 support targeting Android 11. Refer to Unity's 2020
Gradle for Android
documentation for detailed version information. To summarize:
Unity 2020.1, 2020.2 and 2020.3 up to and including 2020.3.14f1 ship with
Gradle 5.6.4 or later (and Gradle plugin 3.6.0 or later).
No action is required.
Unity 2020.3.15f1 and later ship with Gradle 6.1.1 or later (and
Gradle plugin 4.0.1 or later). No action is required.
Unity 2019.4
In Unity, open Unity Preferences > External Tools and set the custom
Gradle to Gradle 5.6.4 or later. See
Gradle build tool for downloads.

Go to Project Settings > Player > Android > Publishing Settings >
Build, and select both:
- Custom Main Gradle Template
- Custom Launcher Gradle Template.

Apply the following changes to both generated files:
Assets/Plugins/Android/mainTemplate.gradle
Assets/Plugins/Android/launcherTemplate.gradle
If present, remove the following comment at the top of the file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
Insert the following lines at the top of the file:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// Must be Android Gradle Plugin 3.6.0 or later. For a list of
// compatible Gradle versions refer to:
// https://developer.android.com/studio/releases/gradle-plugin
classpath 'com.android.tools.build:gradle:3.6.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[null,null,["Last updated 2025-07-14 UTC."],[[["\u003cp\u003eTo support Android 11 with ARCore Extensions for AR Foundation, you need Gradle version 5.6.4 or later and usually Android Gradle plugin version 3.6.0.\u003c/p\u003e\n"],["\u003cp\u003eUnity 2021 and 2020 versions already include the necessary Gradle and plugin versions for Android 11 compatibility by default.\u003c/p\u003e\n"],["\u003cp\u003eFor Unity 2019.4, you need to manually update Gradle to 5.6.4 or later, enable custom Gradle templates, and modify these templates to use Android Gradle plugin 3.6.0.\u003c/p\u003e\n"],["\u003cp\u003eYou can find detailed information about compatible Gradle and Android Gradle plugin versions in the provided links, as well as guidance on Unity's Gradle support and Android build configuration.\u003c/p\u003e\n"]]],["To use ARCore Extensions for AR Foundation with Android 11, ensure Gradle version 5.6.4+ and Android Gradle plugin 3.6.0+ are utilized. Unity 2020 and 2021+ versions generally include compatible versions, requiring no action. Unity 2019.4 users need to manually set Gradle to 5.6.4+ and modify both `mainTemplate.gradle` and `launcherTemplate.gradle` files, adding buildscript and allprojects repositories, and setting the plugin to version 3.6.0.\n"],null,["# Build for Android 11 with Unity\n\nTo support Android 11 (API level 30), the [package visibility](https://developer.android.com/training/package-visibility)\n`\u003cqueries\u003e` element was added to ARCore Extensions for AR Foundation (1.19 or later).\nWhen using these versions of ARCore, the `\u003cqueries\u003e` element requires Gradle version\n5.6.4 or later.\n\nIn most cases, using the ***Android Gradle plugin* version 3.6.0** is\nsufficient. To confirm compatibility between the Android Gradle plugin and the\nGradle version you are using, consult the Android Gradle plugin\n[compatibility table](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle).\n\nUnity gradle support\n--------------------\n\nInstructions for supported versions of Unity are listed in the following\nsections.\n\nFor more information see these articles:\n\n- Unity's [Gradle support](https://docs.unity3d.com/Manual/android-gradle-overview.html)\n- Android's [Configure Gradle Build](https://developer.android.com/studio/build)\n\nUnity 2021 and later\n--------------------\n\nAll versions of Unity 2021 support targeting Android 11. Refer to Unity's 2021\n[Gradle for Android](https://docs.unity3d.com/2021.2/Documentation/Manual/android-gradle-overview.html)\ndocumentation for detailed version information. To summarize:\n\n- Unity 2021.1 up to and including 2021.1.15f1 ship with Gradle 5.6.4 or later\n (and Gradle plugin 3.6.0 or later). No action is required.\n\n- Unity 2021.1.16f1 and later ship with Gradle 6.1.1 or later (and\n Gradle plugin 4.0.1 or later). No action is required.\n\nUnity 2020\n----------\n\nAll versions of Unity 2020 support targeting Android 11. Refer to Unity's 2020\n[Gradle for Android](https://docs.unity3d.com/2020.3/Documentation/Manual/android-gradle-overview.html)\ndocumentation for detailed version information. To summarize:\n\n- Unity 2020.1, 2020.2 and 2020.3 up to and including 2020.3.14f1 ship with\n Gradle 5.6.4 or later (and Gradle plugin 3.6.0 or later).\n No action is required.\n\n- Unity 2020.3.15f1 and later ship with Gradle 6.1.1 or later (and\n Gradle plugin 4.0.1 or later). No action is required.\n\nUnity 2019.4\n------------\n\n1. In Unity, open **[Unity Preferences](https://docs.unity3d.com/2019.4/Documentation/Manual/Preferences.html) \\\u003e [External Tools](https://docs.unity3d.com/2019.4/Documentation/Manual/Preferences.html#external-tools)** and set the custom\n **Gradle** to Gradle **5.6.4** or later. See\n [Gradle build tool](https://gradle.org/releases/) for downloads.\n\n2. Go to **Project Settings \\\u003e Player \\\u003e Android \\\u003e Publishing Settings \\\u003e\n Build**, and select both:\n\n 1. **Custom Main Gradle Template**\n 2. **Custom Launcher Gradle Template**.\n\n3. Apply the following changes to both generated files:\n\n - `Assets/Plugins/Android/mainTemplate.gradle`\n - `Assets/Plugins/Android/launcherTemplate.gradle`\n\n If present, remove the following comment at the top of the file: \n\n // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN\n\n Insert the following lines at the top of the file: \n\n buildscript {\n repositories {\n google()\n mavenCentral()\n }\n dependencies {\n // Must be Android Gradle Plugin 3.6.0 or later. For a list of\n // compatible Gradle versions refer to:\n // https://developer.android.com/studio/releases/gradle-plugin\n classpath 'com.android.tools.build:gradle:3.6.0'\n }\n }\n\n allprojects {\n repositories {\n google()\n mavenCentral()\n flatDir {\n dirs 'libs'\n }\n }\n }"]]