Unity: All versions | Appodeal SDK: All versions

The error "Missing 'package' key attribute on element package" during the build for different packages inside Appodeal SDK (MyTarget, Facebook, Yandex, etc. ) occurs if the Gradle version is not compatible with new default settings and features for package visibility in Android 11 and doesn't matches the one of listed here

The error log examples from Unity Editor Log:

-Missing 'package' key attribute on element package at [com.facebook.android:audience-network-sdk:6.5.1] AndroidManifest.xml:12:9-55
-[com.facebook.android:audience-network-sdk:6.5.1] C:\Users\User\.gradle\caches\transforms-2\files-2.1\90ae6591b63c7214a4618c0480fa9104\AndroidManifest.xml Error:
-Validation failed, exiting
-Execution failed for task ':launcher:processReleaseManifest'.

Missing 'name' key attribute on element provider at [com.yandex.android:mobmetricalib:3.20.1] AndroidManifest.xml:26:9-28:54
[com.yandex.android:mobmetricalib:3.20.1] C:\Users\User\.gradle\caches\transforms-2\files-2.1\5940db64a8e232109b21ef62c4b41386\jetified-mobmetricalib-3.20.1\AndroidManifest.xml Error:
Validation failed, exiting

To fix it change your Gradle version to match the one of listed here:

  1. Go to Player Settings Publishing Settings and enable Custom Base Gradle Template flag.
  2. Go to AssetsPlugins Android baseProjectTemplate.gradle, open the file and change classpath 'com.android.tools.build:gradle:3.6.0' to 'com.android.tools.build:gradle:3.6.4'.

    If you have already been using gradle plugin 4.0.1 version or higher, no change is required.