The Android workload in .NET 7 supports Windows on Arm64, with a few manual workarounds. We are working to address these in future .NET 7 previews.
Pick a Windows arm64
build that is at least .NET
7.0.100-preview.6. Note that these builds are not signed, so you will
have to bypass some Windows prompts.
After install you should see at least Preview 6:
> dotnet --version
7.0.100-preview.6.22277.6
If you are installing to C:\Program Files\dotnet
, delete the feature flag:
C:\Program Files\dotnet\metadata\workloads\7.0.100\installertype\msi
In a terminal running as Administrator, run:
> dotnet workload update --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
This downloads the latest files in C:\Program Files\dotnet\sdk-manifests
.
The Mono workloads from dotnet/runtime need a small fix.
Open C:\Program Files\dotnet\sdk-manifests\7.0.100\microsoft.net.workload.mono.toolchain\WorkloadManifest.json
in your favorite text editor.
Do a Find/Replace
for:
--"win-x64",
++"win-x64", "win-arm64",
Next, anywhere you see a win-x64
alias, add an additional row for win-arm64
:
"alias-to": {
"win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86",
++"win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86",
In a terminal running as Administrator, run:
> dotnet workload install android --skip-manifest-update --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
--skip-manifest-update
is very important, otherwise it will blow
away your manual changes to WorkloadManifest.json
.
The simplest way to get the Android SDK, is to install Android Studio. Unfortunately, there is not yet a Windows on Arm64 version of Android Studio.
Download the Windows 64-bit version of Android Studio for now, and install an Android SDK.
Download Microsoft OpenJDK 11 for AArch64 / ARM64
.
It is not currently possible to create Android emulators from Android Studio or Visual Studio.
However, Windows Subsystem for Android works just fine! After you've setup your development environment, I would recommend a few additional settings:
- Open
Windows Subsystem for Android Settings
. - Toggle
Subsystem Resources
>Continuous
on - Toggle
Developer Mode
on
Once this is setup, you should be able to connect adb
:
> adb connect 127.0.0.1:58526
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 127.0.0.1:58526
At this point you should be able to view adb logcat
output or do
other commands.
The .NET for Android workload doesn't know how to locate Android Studio's Android SDK by default. This is because it is normally managed by Visual Studio.
A couple options to fix this:
-
Set the
%AndroidSdkDirectory%
environment variable system-side to%LocalAppData%\Android\Sdk\
. -
Add to your
.csproj
:
<AndroidSdkDirectory>$(LocalAppData)\Android\Sdk\</AndroidSdkDirectory>
Start in a new folder:
> dotnet new android
> dotnet build -t:Run