Cómo establecer la compilación de aplicación para Android 11 en Unity 2019
To support Android 11 (API level 30), the package visibility <queries>
element was added to some Android libraries. The <queries>
element requires Gradle version 5.6.4 or later. It is recommended to use Gradle version 6.9.2 as this version is supported by Unity 2019, 2020, and 2021.
In Unity version 2020 and higher, Gradle version with Android 11 support is installed by default.
To install Gradle with Android 11 support, follow these steps:
- Download Gradle 6.9.2.
- Open your project in Unity Editor.
- In the main menu, go to
Edit > Preferences (Windows) orUnity > Preferences (macOS). - Go to
External Tools > Android section. - Uncheck the
Gradle installed with Unity box. - In the
Gradle field, clickBrowse and select the folder with Gradle 6.9.2 files.
- In the main menu, go to
Edit > Project Settings . - Go to
Player > Android tab. - In the
Publishing Settings > Build section, check theCustom Main Gradle Template ,Custom Launcher Gradle Template , andCustom Gradle Properties Template boxes. - Add the following line in the
Assets/Plugins/Android/gradleTemplate.properties
file:
- groovy
android.useAndroidX=true
- Make the following changes in the
Assets/Plugins/Android/mainTemplate.gradle
andAssets/Plugins/Android/launcherTemplate.gradle
files:- Delete the following comment at the beginning of the file (may be missing):
- groovy
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
- Add the following lines in the beginning of the file:
- groovy
buildscript {
repositories {
google()
jcenter()
}
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()
jcenter()
flatDir {
dirs 'libs'
}
}
}
¿Has encontrado una errata u otro error de texto? Selecciona el texto y pulsa Ctrl+Intro.