-
Notifications
You must be signed in to change notification settings - Fork 564
Known issues in .NET
.NET 7 RC 1 does not yet support this scenario for Release builds. However, most Debug and development scenarios should work for net6.0-android apps.
Currently a few fixes will be needed in the next release to fully enable this scenario:
- https://github.com/xamarin/xamarin-android/pull/7345
- https://github.com/xamarin/xamarin-android/pull/7365
- https://github.com/dotnet/runtime/pull/75311
Until then, you have a couple options:
- Change
net6.0-everywhere tonet7.0-. OR... - Use a
global.jsonand pin to the stable .NET 6 SDK & Android workload:
{
"sdk": {
"version": "6.0.400",
"rollForward": "latestMinor"
}
}Once you have a global.json in the current directory, you may need to run dotnet workload install android if the stable .NET 6 SDK does not have the required workload.
This will manifest as a build error like this:
error : The RuntimeIdentifier 'android-arm64' is invalid.
The cause is that by passing -r <runtime identifier> to 'dotnet build' that runtime identifier is used for all target frameworks in the project file when the project is restored, while it's only a valid runtime identifier for one of the target frameworks.
Potential workaround is to restore manually, and build without restoring:
$ dotnet restore
$ dotnet build --no-restore -f net6.0-android -r android-arm64This happens with dotnet publish as well.
This will be fixed in a future version of NuGet.
Ref: https://github.com/dotnet/sdk/issues/21877.
Ref: https://github.com/NuGet/Home/issues/11653.
In some cases .aar files are not packaged correctly for .nupkg output of Android class libraries.
For example:
dotnet new androidlib- Add
MyAndroidLibrary.aarfile dotnet pack-
lib\net6.0-android31.0\MyAndroidLibrary.aaris missing from the.nupkg
To workaround this issue, add the following to your .csproj file:
<ItemGroup>
<AndroidLibrary Update="**\*.aar" Pack="false" />
<None Update="**\*.aar" Pack="true" PackagePath="lib\$(TargetFramework)$(TargetPlatformVersion)" />
</ItemGroup>Ref: https://github.com/xamarin/xamarin-android/issues/7040.
Ref: https://github.com/xamarin/xamarin-android/pull/7045.
- APK Tests on the Hyper V Emulator
- Design Time Build System
- Profile MSBuild Tasks
- Diagnose Fast Deployment Issues
- Preview layout XML files with Android Studio
- Documentation