diff --git a/build-tools/banned-apis/banned-apis.targets b/build-tools/banned-apis/banned-apis.targets
index b75161c9f1f..2ce94ab256a 100644
--- a/build-tools/banned-apis/banned-apis.targets
+++ b/build-tools/banned-apis/banned-apis.targets
@@ -1,9 +1,9 @@
-
-
- RS0030
-
-
-
-
-
-
+
+
+ RS0030
+
+
+
+
+
+
diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets
index 293f19585ef..b21afc1b6e4 100644
--- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets
+++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets
@@ -49,14 +49,14 @@
<_PostTrimTrimmableTypeMapInputAssemblies Include="@(ResolvedFileToPublish)"
- Condition=" '%(Extension)' == '.dll' " />
+ Condition=" '%(Extension)' == '.dll' and ('%(RuntimeIdentifier)' == '' or '$(_PostTrimTypeMapFirstRuntimeIdentifier)' == '' or '%(RuntimeIdentifier)' == '$(_PostTrimTypeMapFirstRuntimeIdentifier)') " />
$(_TypeMapBaseOutputDir)typemap/java
<_TypeMapAssembliesListFile>$(_TypeMapOutputDirectory)typemap-assemblies.txt
<_PostTrimTypeMapJavaOutputDirectory>$(_TypeMapBaseOutputDir)typemap/linked-java
+ <_PostTrimTypeMapFirstRuntimeIdentifier Condition=" '$(RuntimeIdentifiers)' != '' ">$([System.String]::Copy('$(RuntimeIdentifiers)').Split(';')[0])
+ <_PostTrimTypeMapFirstRuntimeIdentifier Condition=" '$(_PostTrimTypeMapFirstRuntimeIdentifier)' == '' ">$(RuntimeIdentifier)
<_TypeMapJavaStubsSourceDirectory Condition=" '$(_TypeMapJavaStubsSourceDirectory)' == '' and '$(_AndroidRuntime)' == 'CoreCLR' and '$(PublishTrimmed)' == 'true' ">$(_PostTrimTypeMapJavaOutputDirectory)
<_TypeMapJavaStubsSourceDirectory Condition=" '$(_TypeMapJavaStubsSourceDirectory)' == '' ">$(_TypeMapJavaOutputDirectory)
<_PostTrimTrimmableTypeMapJavaStamp>$(_TypeMapBaseOutputDir)stamp/_GeneratePostTrimTrimmableTypeMapJavaSources.stamp
@@ -251,8 +253,20 @@
We keep _GetGenerateJavaStubsInputs in DependsOnTargets so that downstream targets
(_GetGeneratePackageManagerJavaInputs) can still read @(_GenerateJavaStubsInputs).
-->
+
diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
index 32906eab047..033dec10628 100644
--- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
+++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
@@ -56,6 +56,10 @@ static IEnumerable