Kits SDK para Unity / Cómo establecer la compilación de aplicación para Android 11 en Unity 2019
  Volver a Documentos

Kits SDK para Unity

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:

  1. Download Gradle 6.9.2.
  2. Open your project in Unity Editor.
  3. In the main menu, go to Edit > Preferences (Windows) or Unity > Preferences (macOS).
  4. Go to External Tools > Android section.
  5. Uncheck the Gradle installed with Unity box.
  6. In the Gradle field, click Browse and select the folder with Gradle 6.9.2 files.
  1. In the main menu, go to Edit > Project Settings.
  2. Go to Player > Android tab.
  3. In the Publishing Settings > Build section, check the Custom Main Gradle Template, Custom Launcher Gradle Template, and Custom Gradle Properties Template boxes.
  4. Add the following line in the Assets/Plugins/Android/gradleTemplate.properties file:
Copy
Full screen
Small screen
android.useAndroidX=true
  1. Make the following changes in the Assets/Plugins/Android/mainTemplate.gradle and Assets/Plugins/Android/launcherTemplate.gradle files:
    1. Delete the following comment at the beginning of the file (may be missing):
Copy
Full screen
Small screen
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
    1. Add the following lines in the beginning of the file:
Copy
Full screen
Small screen
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'
  		}
	}
}
¿Te ha resultado útil este artículo?
¡Gracias!
¿Hay algo en lo que podamos mejorar? Mensaje
Lo sentimos
Por favor, cuéntanos por qué no te ha resultado útil este artículo. Mensaje
¡Gracias por tu mensaje!
Nos ayudará a mejorar tu experiencia.
Valore esta página
Valore esta página
¿Hay algo en lo que podamos mejorar?

Prefiero no responder

¡Gracias por tu mensaje!
Última actualización: 15 de Septiembre de 2023

¿Has encontrado una errata u otro error de texto? Selecciona el texto y pulsa Ctrl+Intro.

Informar de un problema
Nos esforzamos por ofrecer contenido de calidad. Tus comentarios nos ayudan a mejorar.
Déjanos tu correo electrónico para que te podamos responder
¡Gracias por tu mensaje!