Build Failure With Queries
<queries>
<package android:name="com.bhaptics.player" />
</queries>
Problem
When building with the "queries" option, you may encounter a build error due to the low version of Gradle installed with Unity.
D:\dev\unity\gradle-test\Temp\gradleOut\unityLibrary\src\main\AndroidManifest.xml:4:5-51 Error: Missing 'package' key attribute on element package at AndroidManifest.xml:4:5-51 D:\dev\unity\gradle-test\Temp\gradleOut\unityLibrary\src\main\AndroidManifest.xml Error: Validation failed, exiting
Solution
To resolve this problem, you need to set up the following two things.
- Change gradle to newer one.
- Change gradle build tool version to newer.
Change gradle to newer one
Edit > Preferences > External Tools > Uncheck gradle and select newer version.
You can obtain the newer version of Gradle from Unity. Please note that the Gradle.zip file provided is from Unity 2020.3.23f1.
Change gradle build tool version to newer
ProjectSetting > Player > Android > Publishing Settings > Check "Custom Base Gradle Template"
Then, Open "baseProjectTemplate.gradle" in Assets/Plugins/Android
folder and change version from 3.4.0 to 3.4.3
For more about the version, you can refer to this link.