Reputation: 137
i am using ARFoundation 4.1.0 preview package and in XR plug-in management in unity project settings i have enabled the Arcore but the problem is when i build it gives me "Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54". and when i disable the Arcore it works fine but i get black screen camera.
Upvotes: 6
Views: 21527
Reputation: 101
I have similar question with you, but I was using ARcore SDK.
This issue happens for the combination of:
Basically, updating build-tools to 31 is not enough to support
queries
element (of manifest, added since Android 11+). Gradle needs to be updated, too.
I solved it by changing Gradle-plugin in my assets--plugins--android--mainTemplate.gradle
file, from 3.4.0
to 3.6.0
, like:
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
you may need to check "Customer Gradle Templete" in player setting-publishing setting-build, to create this file
Upvotes: 10
Reputation: 13733
Find the Gradle version that your Unity version uses from here.
Then find the latest Gradle plugin version compatible with the Gradle version found in step one from here.
In the Publishing Settings section in the Player Settings, tick the Custom Gradle Template
option. Unity then generates a default mainTemplate.gradle
file in Assets/Plugins/Android/
folder.
In the mainTemplate.gradle
file, update the com.android.tools.build:gradle
plugin version to the newer version found in step 2.
Upvotes: 1
Reputation: 1
This is due to the gradle file configuration issue. You have to manually make some changes in the custom gradle files in Unity 3D 2019+ versions.
Go to Preferences > External Tools > Android > Gradle
, and set the custom Gradle to Gradle 5.6.4 or later. If you are already having it then skip the step.
Go to Project Settings > Player > Android tab > Publishing Settings > Build
, and select both:
Custom Main Gradle Template
Custom Launcher Gradle Template.
Apply the following changes to both generated files:
Assets/Plugins/Android/mainTemplate.gradle
Assets/Plugins/Android/launcherTemplate.gradle
If present, remove the following comment at the top of the file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
Insert the following lines at the top of the file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
Upvotes: 1
Reputation: 137
i solved it by reverting back from ar foundation preview 10 4.1.0 to preview-2
Upvotes: 3