Cannot build for Android 11, getting gradle build errors

  • Issue category: Unity Example Package
  • Device type & OS version: Android 11
  • Host machine & OS version: Windows 10
  • Issue Environment : Unity Remote / On Device
  • ARDK version: 1.1.0
  • Unity version: 2019.4.33f1
  • Gradle version: 5.6.4 and also tried with 6.2

Description of the issue:
Hello!,
I unfortunately updated my Android device to Android 11 I tried the fix for it that is given in the docs but it is giving me few errors related to Gradle

1.

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :launcher:prepareLintJar
> Task :unityLibrary:checkReleaseManifest

> Task :unityLibrary:processReleaseManifest FAILED

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

3 actionable tasks: 3 executed

UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()

2.

Project\Temp\gradleOut\unityLibrary\src\main\AndroidManifest.xml:32:5-50 Error:
	Missing 'package' key attribute on element package at AndroidManifest.xml:32:5-50

Project\Temp\gradleOut\unityLibrary\src\main\AndroidManifest.xml Error:
	Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':unityLibrary:processReleaseManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()

I cannot understand the 1st one but the 2nd one points the query snippet that I copy pasted from the docs

Fixed it by

  1. using Gradle 5.6.4
  2. following the steps given here (making a Custom Main Gradle Template and Custom Launcher Gradle Template .)
  3. Adding the query snippet from the docs

Suggestion:
I would replace the Enable ARCore  |  Google Developers link given in the docs with Construye para Android 11 con Unity  |  ARCore  |  Google Developers
Since the steps in the second one seemed to work for me the first one gave me the above errors since it told me to add the snippets that were giving me the errors

Hi Ansh, glad you were able to find a solution. Let us know if you run into any other issues.

1 Like

This topic was automatically closed 2 hours after the last reply. New replies are no longer allowed.