SDKs para Unity / Como configurar a compilação do aplicativo para Android 11 no Unity 2019
  Voltar aos Documentos

SDKs para Unity

Como configurar a compilação do aplicativo para Android 11 no 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'
  		}
	}
}
Este artigo foi útil?
Obrigado!
Podemos melhorar alguma coisa? Mensagem
Que pena ouvir isso
Explique porque este artigo não foi útil para você. Mensagem
Obrigado pelo seu feedback!
Avaliaremos sua mensagem e a usaremos para melhorar sua experiência.
Avalie esta página
Avalie esta página
Podemos melhorar alguma coisa?

Não quero responder

Obrigado pelo seu feedback!
Última atualização: 15 de Setembro de 2023

Encontrou um erro de texto ou digitação? Selecione o texto e pressione Ctrl+Enter.

Relatar um problema
Nós sempre avaliamos nossos conteúdos. Seu feedback nos ajuda a melhorá-los.
Forneça um e-mail para que possamos responder
Obrigado pelo seu feedback!