Skip to content

[NET 11] Fast Deployment fails with "run-as: unknown package" then "Permission denied" on arm64 emulator #11644

@kotlarmilos

Description

@kotlarmilos

Android framework version

net11.0-android, Microsoft.Android.Sdk.Darwin 36.99.0-preview.5.308

Affected platform version

.NET SDK 11.0.100-preview.5.26302.115 (.NET 11 Preview 5), VS Code .NET MAUI extension 1.16.53

Description

dotnet build -t:Run with Fast Deployment enabled (the default for Debug) fails with XA0126 when deploying to an AOSP (default tag) arm64 emulator. The app is never installed. The same project builds and runs once EmbedAssembliesIntoApk=true is set, which disables Fast Deployment. -p:_FastDeploymentDiagnosticLogging=true shows the underlying cause: the run-as step reports the package is unknown, and the subsequent push into the app-private files/.__tools__ directory is denied.

Steps to Reproduce

  1. dotnet new maui -n DogfoodApp

  2. Boot an AOSP system image emulator: API 34, default/arm64-v8a tag (created via avdmanager, not a google_apis image).

  3. Ensure the app is not already installed: adb uninstall com.companyname.dogfoodapp

  4. Build and run with Fast Deployment and diagnostic logging:

    dotnet build -t:Run -p:Configuration=Debug -f net11.0-android -p:AdbTarget="-s emulator-5554" -p:EmbedAssembliesIntoApk=false -p:_FastDeploymentDiagnosticLogging=true -bl:fastdeploy.binlog
    

Did you find any workaround?

Yes. Set EmbedAssembliesIntoApk=true for Debug Android, which disables Fast Deployment. The app then deploys and runs:

<PropertyGroup Condition="'$(Configuration)' == 'Debug' And $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
  <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>

Relevant log output

Fast Deployment diagnostic output (_FastDeploymentDiagnosticLogging=true):

RunShellCommand emulator-5554 "run-as" "com.companyname.dogfoodapp" "pwd"
  pwd returned: run-as: unknown package: com.companyname.dogfoodapp
RunShellCommand emulator-5554 "run-as" "com.companyname.dogfoodapp" "cat" "files/.__tools__/version"
  cat returned: cat: files/.__tools__/version: No such file or directory
RunShellCommand emulator-5554 "run-as" "com.companyname.dogfoodapp" "mkdir" "-p" "files/.__tools__"
Installing FastDev Tool files/.__tools__/xamarin.find for arm64-v8a
Failed to push xamarin.find to files/.__tools__/xamarin.find. Mono.AndroidTools.AdbException: couldn't create file: Permission denied
  deploy.error.code: XA0126

Error:

Xamarin.Android.Common.Debugging.targets(333,5): error XA0126: Unable to copy Fast Deployment tools to 'files/.__tools__/xamarin.find' on the target device. This device might not be compatible with Fast Deployment.

Full binlog attached: fastdeploy.binlog.

Environment

Component Version
Host macOS (Darwin), arm64
.NET SDK 11.0.100-preview.5.26302.115
Android SDK pack Microsoft.Android.Sdk.Darwin 36.99.0-preview.5.308
Emulator 36.5.10.0
adb 1.0.41
AVD API 34 (Android 14, UpsideDownCake), default/arm64-v8a

Analysis

Fast Deployment pushes its helper tools into the app-private files/ directory via run-as. On this AOSP (default tag) arm64 image, run-as returns unknown package and the push into files/.__tools__ fails with Permission denied, so xamarin.find is never installed and the build aborts with XA0126. The package is never installed by the run, so this is not a stale-install issue. It reproduces specifically on the default (AOSP) system image; google_apis images may behave differently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssues that need to be assigned.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions