Unable to deply hololens app via Unity

Lorans 1 Reputation point
2021-12-21T03:44:32.007+00:00

I am using MRTK 2.7.2 and unity 2020.3.16f1.
I used the MRTJK Feature tool to import the MRTK package and configure the project.

I followed the project configurations in here (https://learn.microsoft.com/en-us/learn/modules/learn-mrtk-tutorials/1-5-exercise-configure-resources) and I build a big project but I couldn't deploy it using Unity "Build and Run on Remote Device". I tried to build the app using VS, it deployed but I was seeing the spatial awareness mesh and the app was pretty leggy.

I decided to start a new project following the same project setup instructions and I added only one cub. I tried to build and run the app from Unity but it didn't work either. It goes through the entire process then it gets stuck at "running" for one min then I get the following errors;

BuildFailedException: Deployment failed.
Output:Starting Appx installation...
Attempting to query installed packages matching app
Successfully retrieved installed packages matching app from the device
Copying: SAware_1.0.0.0_ARM64.appx
Failed to install SAware_1.0.0.0_ARM64.appx: Copying: SAware_1.0.0.0_ARM64.appx
Installation of Appx failed!
Installation failed in phase Idle - last status: Failed to install SAware_1.0.0.0_ARM64.appx: Copying: SAware_1.0.0.0_ARM64.appx
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at DevicePortalTool.AppOperation.ExecuteInstallAppx(ParameterHelper parameters, String appxFile, String certificate)
at DevicePortalTool.AppOperation.ExecuteInstallOperation(ParameterHelper parameters)
at DevicePortalTool.AppOperation.ExecuteOperationInternal(Operation op, ParameterHelper parameters)

ExitCode: -1 (OperationFailed)

ApplicationLauncherImpl.RunOnDevicePortalDevice (System.String appxPath, System.String playerPackage) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:440)
ApplicationLauncherImpl.Run (Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:360)
ApplicationLauncher.BuildAndRunProject (UnityEditor.Modules.BuildLaunchPlayerArgs args, UnityEditor.WSABuildAndRunDeployTarget deployTarget, System.String platform, Utility+VisualStudio vs) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:71)
ApplicationLauncher.BuildAndRun (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ApplicationLauncher.cs:39)
UnityEditor.UWP.BuildPostprocessor.LaunchPlayer (UnityEditor.Modules.BuildLaunchPlayerArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:78)
UnityEditor.PostprocessBuildPlayer.Launch (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget buildTarget, System.String path, System.String productName, UnityEditor.BuildOptions options, UnityEditor.Build.Reporting.BuildReport buildReport) (at <ef3b6bf002d8435a97b4e938f6c49b02>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

-------------------------------------------------------------------------------------------------------------------------------------------

Build completed with a result of 'Failed' in 405 seconds (404736 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

--------------------------------------------------------------------------------------------------------------------------------------------

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <ef3b6bf002d8435a97b4e938f6c49b02>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <ef3b6bf002d8435a97b4e938f6c49b02>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
402 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hernando Ren 2,171 Reputation points
    2021-12-21T06:13:40.627+00:00

    Hello, Welcome to Microsoft Q&A,

    Since the MR app is a UWP app, "Build and Run on Remote Device" is not support deploying the MR app to HoloLens in Unity directly. We always build the Unity project first, and after it has finished, navigate into the folder that contains your newly-created solution file and find the solution file located inside this folder and open it with visual studio. For more information please refer to this link: Build and deploy to the HoloLens

    ----
    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.