Skip to content

Commit effc9c8

Browse files
[One .NET] default $(TargetPlatformVersion) to 32
Currently, if you build with `net6.0-android` and leave off the number, it defaults to API 31. Let's bump this to API 32, Android 12L. I also fixed the `Inputs` of the `_GenerateSupportedPlatforms` target, so it will rerun when `Configuration.props` changes. We will likely need to coordinate the API level installed by various Visual Studio installers.
1 parent c80dfff commit effc9c8

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

Configuration.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
<AndroidFirstFrameworkVersion Condition="'$(AndroidFirstFrameworkVersion)' == ''">v4.4</AndroidFirstFrameworkVersion>
2727
<AndroidFirstApiLevel Condition="'$(AndroidFirstApiLevel)' == ''">19</AndroidFirstApiLevel>
2828
<AndroidJavaRuntimeApiLevel Condition="'$(AndroidJavaRuntimeApiLevel)' == ''">21</AndroidJavaRuntimeApiLevel>
29-
<!-- The default API level used for $(TargetPlatformVersion) -->
30-
<AndroidDefaultTargetDotnetApiLevel Condition="'$(AndroidDefaultTargetDotnetApiLevel)' == ''">31</AndroidDefaultTargetDotnetApiLevel>
3129
<!-- The min API level supported by Microsoft.Android.Sdk, should refactor/remove when this value is the same as $(AndroidFirstApiLevel) -->
3230
<AndroidMinimumDotNetApiLevel Condition="'$(AndroidMinimumDotNetApiLevel)' == ''">21</AndroidMinimumDotNetApiLevel>
3331
<AndroidFirstPlatformId Condition="'$(AndroidFirstPlatformId)' == ''">$(AndroidFirstApiLevel)</AndroidFirstPlatformId>
@@ -39,6 +37,8 @@
3937
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">32</AndroidLatestUnstableApiLevel>
4038
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">32</AndroidLatestUnstablePlatformId>
4139
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v12.1</AndroidLatestUnstableFrameworkVersion>
40+
<!-- The default API level used for $(TargetPlatformVersion) in .NET 6, can be increased again in .NET 7 -->
41+
<AndroidDefaultTargetDotnetApiLevel Condition=" '$(AndroidDefaultTargetDotnetApiLevel)' == '' ">32</AndroidDefaultTargetDotnetApiLevel>
4242
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
4343
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
4444
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>

src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"description": ".NET SDK Workload for building Android applications.",
66
"packs": [
77
"Microsoft.Android.Sdk",
8-
"Microsoft.Android.Ref.31",
98
"Microsoft.Android.Ref.32",
109
"Microsoft.Android.Runtime.32.android-arm",
1110
"Microsoft.Android.Runtime.32.android-arm64",
@@ -29,10 +28,6 @@
2928
"linux-x64": "Microsoft.Android.Sdk.Linux"
3029
}
3130
},
32-
"Microsoft.Android.Ref.31": {
33-
"kind": "framework",
34-
"version": "31.0.101-preview.11.117"
35-
},
3631
"Microsoft.Android.Ref.32": {
3732
"kind": "framework",
3833
"version": "@WORKLOAD_VERSION@"

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void DotNetNew ([Values ("android", "androidlib", "android-bindinglib")]
217217
}
218218

219219
[Test]
220-
public void DotNetPack ([Values ("net6.0-android", "net6.0-android31")] string targetFramework)
220+
public void DotNetPack ([Values ("net6.0-android", "net6.0-android32")] string targetFramework)
221221
{
222222
var proj = new XASdkProject (outputType: "Library") {
223223
TargetFramework = targetFramework,
@@ -249,8 +249,8 @@ public void DotNetPack ([Values ("net6.0-android", "net6.0-android31")] string t
249249
var nupkgPath = Path.Combine (FullProjectDirectory, proj.OutputPath, "..", $"{proj.ProjectName}.1.0.0.nupkg");
250250
FileAssert.Exists (nupkgPath);
251251
using (var nupkg = ZipHelper.OpenZip (nupkgPath)) {
252-
nupkg.AssertContainsEntry (nupkgPath, $"lib/net6.0-android31.0/{proj.ProjectName}.dll");
253-
nupkg.AssertContainsEntry (nupkgPath, $"lib/net6.0-android31.0/{proj.ProjectName}.aar");
252+
nupkg.AssertContainsEntry (nupkgPath, $"lib/net6.0-android32.0/{proj.ProjectName}.dll");
253+
nupkg.AssertContainsEntry (nupkgPath, $"lib/net6.0-android32.0/{proj.ProjectName}.aar");
254254
}
255255
}
256256

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
</ReplaceFileContents>
220220
</Target>
221221
<Target Name="_GenerateSupportedPlatforms"
222-
Inputs="$(BootstrapTasksAssembly);$(MSBuildThisFile);..\..\bin\Build$(Configuration)\Mono.Android.Apis.projitems"
222+
Inputs="$(BootstrapTasksAssembly);$(MSBuildThisFile);..\..\Configuration.props;..\..\bin\Build$(Configuration)\Mono.Android.Apis.projitems"
223223
Outputs="Microsoft.Android.Sdk\targets\Microsoft.Android.Sdk.SupportedPlatforms.targets">
224224
<GenerateSupportedPlatforms
225225
AndroidApiInfo="@(AndroidApiInfo)"

0 commit comments

Comments
 (0)