Search Unity

Resolved Adding ARFoundation plugins to empty project causes "Manifest merger failed with multiple errors"

Discussion in 'AR' started by tmr80977, Oct 28, 2020.

  1. tmr80977

    tmr80977

    Joined:
    Sep 9, 2020
    Posts:
    3
    I have an brand-new, empty project in Unity 2019.4.11f1. It builds perfectly fine to Android before making any changes. Then I used the Package Manger to add AR Foundation (2.1.10), AR Subsystems (2.1.3), ARCore XR Plugin (2.1.12), and ARKit XR Plugin (2.1.10) and I made the required changes to the Player Settings (removing Vulcan and rising the minimum APK version to 24). Even with no changes to the scene, Unity's build will fail. I get a pop-up error saying that "Manifest merger failed with multiple errors."
    What can I do to fix this? Thank you!
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    Can you please show the errors?
     
  3. greddu9t

    greddu9t

    Joined:
    Sep 24, 2019
    Posts:
    7
    Same here, the error is :


    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    stderr[
    [:arcore_client:] C:\Users\x\.gradle\caches\transforms-2\files-2.1\5de2c7f84f0cbe35fe629cb6865cc9fc\AndroidManifest.xml:30:9-54 Error:
    Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml:30:9-54
    [:arcore_client:] C:\Users\x\.gradle\caches\transforms-2\files-2.1\5de2c7f84f0cbe35fe629cb6865cc9fc\AndroidManifest.xml Error:
    Validation failed, exiting
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':launcher: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 2s
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[
    > Configure project :launcher
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only
    Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
    > Task :launcher:preBuild UP-TO-DATE
    > Task :unityLibrary:preBuild UP-TO-DATE
    > Task :unityLibrary:preReleaseBuild UP-TO-DATE
    > Task :launcher:prepareLintJar UP-TO-DATE
    > Task :unityLibrary:checkReleaseManifest UP-TO-DATE
    > Task :unityLibrary:processReleaseManifest
    > Task :unityLibrary:compileReleaseAidl NO-SOURCE
    > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
    > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
    > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
    > Task :unityLibrary:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:packageReleaseResources UP-TO-DATE
    > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
    > Task :unityLibrary:prepareLintJar UP-TO-DATE
    > Task :unityLibrary:generateReleaseSources UP-TO-DATE
    > Task :launcher:preReleaseBuild
    > Task :launcher:compileReleaseAidl NO-SOURCE
    > Task :launcher:compileReleaseRenderscript NO-SOURCE
    > Task :launcher:checkReleaseManifest UP-TO-DATE
    > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
    > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
    > Task :launcher:generateReleaseSources UP-TO-DATE
    > Task :launcher:mainApkListPersistenceRelease UP-TO-DATE
    > Task :launcher:generateReleaseResValues UP-TO-DATE
    > Task :launcher:generateReleaseResources UP-TO-DATE
    > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
    > Task :unityLibrary:bundleLibCompileRelease UP-TO-DATE
    > Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
    > Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
    > Task :unityLibrary:compileReleaseShaders UP-TO-DATE
    > Task :unityLibrary:generateReleaseAssets UP-TO-DATE
    > Task :launcher:mergeReleaseResources UP-TO-DATE
    > Task :launcher:javaPreCompileRelease UP-TO-DATE
    > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
    > Task :launcher:processReleaseManifest FAILED
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    > Task :unityLibrary:packageReleaseAssets
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
    24 actionable tasks: 4 executed, 20 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <4787bab5d6924cfaa63b02c00dafc983>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <1fe7a3c0284a456b9681b7a93141c89a>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)



    In another project the trick was to set the requirement and depth of Project settings/XR Plug-in management/ARCore to optional, but in my current project it didn't work.
     
  4. greddu9t

    greddu9t

    Joined:
    Sep 24, 2019
    Posts:
    7
    Powzone likes this.
  5. Sylvain_Renault

    Sylvain_Renault

    Joined:
    Jun 6, 2018
    Posts:
    2
    Thank you VERY much greddu9t for the link! Now it's work fine for me too!

    I'm currently using Unity 2019.4 LTS and could deploy now without error for an Android 10 mobil phone with Gradle 5.6.4.

    Why should Unity not provide the correct lib and entries for this?!?
    Editing in some Unity scripts is a bad solution and I have to do this in all future projects manually :-( until I will switch to Unity 2020.
     
  6. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    335
    You can also find our communication about this here. We recommend upgrading to Unity 2020, which doesn't require this workaround and includes a slate of performance & stability improvements.