Skip to content

Commit 6eb11f1

Browse files
authored
[Mono.Android] Bind Android 12L Beta 1. (#6601)
Context: https://developer.android.com/about/versions/12/12L Context: https://android-developers.googleblog.com/2021/12/beta-1-update-for-12l-feature-drop.html Android 12L Developer Beta 1 has been released. * [API diff vs. API-31][0] * [API diff vs. Sv2 DP1][1] The Android 12L Developer Preview Program Overview [Timeline and updates][2] section suggests the following timeline (which differs from ef01121): * October: Developer Preview 1 * December: Beta 1; Final APIs (previously expected in Beta 2) * January: Beta 2; Incremental beta update * February: Beta 3; Incremental beta update * Q1 2022: Final release In particular, Beta 1 has "Final APIs". We now have API-32! Enumify API-32, and declare it stable. As a change from "upstream Google", Classic Xamarin.Android uses `$(TargetFrameworkVersion)`=v12.1 for API-32, as there is no way to express "12L" in a `System.Version`. We have decreed 12.1 as 12L. .NET SDK for Android uses `$(TargetFramework)`=net6.0-android32.0. However, we don't want to change the default API level for .NET 6 projects; the default will remain `net6.0-android31.0` (API-31), using the [31.0.101-preview.11.117 binaries on NuGet.org][3]. This requires various changes to the unit test infrastructure and .NET SDK workflow package creation. Additionally, `d8` doesn't appear to support API-32 yet (?!); building an app with an `AndroidManifest.xml` containing: <uses-sdk android:minSdkVersion="32" android:targetSdkVersion="32" /> would use `d8 --min-api 32`, which results in a warning: D8 : warning : An API level of 32 is not supported by this compiler. Please use an API level of 31 or earlier Update the `XASdkTests.SupportedOSPlatformVersion()` test so that it only uses API-31 and not API-32. This avoids the above warning. Finally, we had to update xaprepare to install the new Android SDK Build-tools version 32.0.0, as `aapt` from previous Build-tools versions would emit a warning when building for API-32: Xamarin.Android.Aapt2.targets(157,3): warning APT2000: aapt2 W 01-05 23:58:06 8352 43857 LoadedArsc.cpp:657] Unknown chunk type '200'. Unfortunately, installing Build-tools 32.0.0 promptly broke unit tests using `$(AndroidDexTool)`=dx, with: COMPILETODALVIK : error : Unable to access jarfile C:\…\android-toolchain\sdk\build-tools\32.0.0\lib\dx.jar as Build-tools 31 and later no longer contains `lib/dx.jar`. Update xaprepare to install *both* Build-tools 30.0.3 *and* 32.0.0, so that tests which require `dx.jar` continue to run, and we can get *some* test coverage against Build-tools 32. Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> [0]: https://developer.android.com/sdk/api_diff/32/changes [1]: https://developer.android.com/sdk/api_diff/32-incr/changes [2]: https://web.archive.org/web/20220113142518/https://developer.android.com/about/versions/12/12L/overview [3]: https://www.nuget.org/packages/Microsoft.Android.Ref.31/31.0.101-preview.11.117
1 parent 4ddcbc4 commit 6eb11f1

34 files changed

+348
-70
lines changed

Configuration.Override.props.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
kept consistent with each other, lest Bad Things Happen™
77
-->
88
<!-- The default Android API level to bind in src/Mono.Android -->
9-
<AndroidApiLevel>31</AndroidApiLevel>
9+
<AndroidApiLevel>32</AndroidApiLevel>
1010
<!-- The Xamarin.Android $(TargetFrameworkVersion) value that corresponds to $(AndroidApiLevel) -->
11-
<AndroidFrameworkVersion>v12.0</AndroidFrameworkVersion>
11+
<AndroidFrameworkVersion>v12.1</AndroidFrameworkVersion>
1212
<!-- The default Android API "id" that corresponds to $(AndroidApiLevel) -->
13-
<AndroidPlatformId>31</AndroidPlatformId>
13+
<AndroidPlatformId>32</AndroidPlatformId>
1414

1515
<!--
1616
Colon-separated list of ABIs to build the mono JIT for.

Configuration.props

+19-9
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@
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>
2931
<!-- The min API level supported by Microsoft.Android.Sdk, should refactor/remove when this value is the same as $(AndroidFirstApiLevel) -->
3032
<AndroidMinimumDotNetApiLevel Condition="'$(AndroidMinimumDotNetApiLevel)' == ''">21</AndroidMinimumDotNetApiLevel>
3133
<AndroidFirstPlatformId Condition="'$(AndroidFirstPlatformId)' == ''">$(AndroidFirstApiLevel)</AndroidFirstPlatformId>
3234
<!-- *Latest* *stable* API level binding that we support; used when building src/Xamarin.Android.Build.Tasks -->
33-
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">31</AndroidLatestStableApiLevel>
35+
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">32</AndroidLatestStableApiLevel>
3436
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
35-
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v12.0</AndroidLatestStableFrameworkVersion>
37+
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v12.1</AndroidLatestStableFrameworkVersion>
3638
<!-- *Latest* *unstable* API level binding that we support; this can be the same as *stable* -->
3739
<AndroidLatestUnstableApiLevel Condition="'$(AndroidLatestUnstableApiLevel)' == ''">32</AndroidLatestUnstableApiLevel>
38-
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">Sv2</AndroidLatestUnstablePlatformId>
39-
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v12.0.99</AndroidLatestUnstableFrameworkVersion>
40+
<AndroidLatestUnstablePlatformId Condition="'$(AndroidLatestUnstablePlatformId)' == ''">32</AndroidLatestUnstablePlatformId>
41+
<AndroidLatestUnstableFrameworkVersion Condition="'$(AndroidLatestUnstableFrameworkVersion)'==''">v12.1</AndroidLatestUnstableFrameworkVersion>
4042
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
4143
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
4244
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>
@@ -118,16 +120,24 @@
118120
<AllSupported64BitTargetAndroidAbis>arm64-v8a;x86_64</AllSupported64BitTargetAndroidAbis>
119121
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
120122
<!--
121-
For some reason, the URL for platform-tools/build-tools 30.0.3 is prefixed with what appears to be a GIT commit hash or some other checksum...
123+
For some reason, the URL for platform-tools/build-tools 32.0.0 is prefixed with what appears to be a GIT commit hash or some other checksum...
122124
Linux packages don't have any prefix, but this forces us to have *some* mechanism to handle this...
123125
-->
124-
<XABuildToolsPackagePrefixMacOS>f6d24b187cc6bd534c6c37604205171784ac5621.</XABuildToolsPackagePrefixMacOS>
125-
<XABuildToolsPackagePrefixWindows>91936d4ee3ccc839f0addd53c9ebf087b1e39251.</XABuildToolsPackagePrefixWindows>
126+
<XABuildToolsPackagePrefixMacOS>5219cc671e844de73762e969ace287c29d2e14cd.</XABuildToolsPackagePrefixMacOS>
127+
<XABuildToolsPackagePrefixWindows>210b77e4bc623bd4cdda4dae790048f227972bd2.</XABuildToolsPackagePrefixWindows>
126128
<XABuildToolsPackagePrefixLinux></XABuildToolsPackagePrefixLinux>
127129
<XABuildToolsPackagePrefix Condition=" '$(HostOS)' == 'Darwin' ">$(XABuildToolsPackagePrefixMacOS)</XABuildToolsPackagePrefix>
128130
<XABuildToolsPackagePrefix Condition=" '$(HostOS)' == 'Windows' ">$(XABuildToolsPackagePrefixWindows)</XABuildToolsPackagePrefix>
129-
<XABuildToolsVersion>30.0.3</XABuildToolsVersion>
130-
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">30.0.3</XABuildToolsFolder>
131+
<XABuildToolsVersion>32</XABuildToolsVersion>
132+
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">32.0.0</XABuildToolsFolder>
133+
<!-- build-tools 30, for DX tests -->
134+
<XABuildTools30PackagePrefixMacOS>f6d24b187cc6bd534c6c37604205171784ac5621.</XABuildTools30PackagePrefixMacOS>
135+
<XABuildTools30PackagePrefixWindows>91936d4ee3ccc839f0addd53c9ebf087b1e39251.</XABuildTools30PackagePrefixWindows>
136+
<XABuildTools30PackagePrefixLinux></XABuildTools30PackagePrefixLinux>
137+
<XABuildTools30PackagePrefix Condition=" '$(HostOS)' == 'Darwin' ">$(XABuildTools30PackagePrefixMacOS)</XABuildTools30PackagePrefix>
138+
<XABuildTools30PackagePrefix Condition=" '$(HostOS)' == 'Windows' ">$(XABuildTools30PackagePrefixWindows)</XABuildTools30PackagePrefix>
139+
<XABuildTools30Version>30.0.3</XABuildTools30Version>
140+
<XABuildTools30Folder Condition="'$(XABuildTools30Folder)' == ''">30.0.3</XABuildTools30Folder>
131141
<XAPlatformToolsPackagePrefix Condition=" '$(HostOS)' == 'Darwin' ">e8b2b4cbe47c728c1e54c5f524440b52d4e1a33c.</XAPlatformToolsPackagePrefix>
132142
<XAPlatformToolsVersion>31.0.3</XAPlatformToolsVersion>
133143
<XAIncludeProprietaryBits Condition="'$(XAIncludeProprietaryBits)' == ''">False</XAIncludeProprietaryBits>

Documentation/workflow/HowToAddNewApiLevel.md

+165-4
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,174 @@ acceptable "breaks":
5454

5555
When Google announces that the APIs are frozen, additional work such as enumification is needed.
5656

57-
---- Somewhat outdated docs below, update when we do this year's stabilization ----
57+
There have been many, many attempts to "automate" the enumification process in the past, to varying
58+
degrees of success. The main problem is that no automated process is going to be perfect, so
59+
they all rely on a human verifying and modifying the results.
60+
61+
However this verification process is long and tedious. Doing it correctly requires almost as much
62+
effort as doing the full process manually. Thus it generally isn't done correctly and many errors
63+
slip in, leaving our users with bad bindings that are hard to fix in the future without breaking API.
64+
65+
Currently we have taken the opposite approach and do the process completely manually, but we
66+
have invested in tooling to make the process as easy as possible.
67+
68+
This tooling is BindingStudio:
69+
https://github.com/jpobst/BindingStudio
70+
71+
It's a Winforms app, so it only runs on Windows. It's ugly as sin, and has very poor UX. However,
72+
it prompts you with the exact decisions you need to make, and handles as much dirty work as possible,
73+
allowing enumification to be done in a few days.
74+
75+
### Extract constants from API
76+
77+
Using BindingStudio:
78+
79+
- Update `CURRENT_API_LEVEL` in MainForm.cs
80+
- Choose `Tools` -> `Add API Level Constants`
81+
- Fill in existing `map.csv`: `xamarin-android/src/Mono.Android/map.csv`
82+
- Fill in new `api.xml`: ex: `xamarin-android/src/Mono.Android/obj/Debug/net6.0/android-32/mcw/api.xml`
83+
- Choose `File` -> `Save`
84+
85+
This adds all the new possible constants from the API level to `map.csv`. They will be
86+
marked with a `?` indicating no determination has been made if they should be enumified or not.
87+
88+
Example:
89+
```
90+
?,32,android/media/Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL,1,,,,
91+
?,32,android/media/Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE,0,,,,
92+
?,32,android/media/Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_OTHER,-1,,,,
93+
```
94+
95+
### Creating enums
96+
97+
Using BindingStudio:
98+
99+
- Choose `File` -> `Open Constant Map`
100+
- Choose existing `map.csv`: `xamarin-android/src/Mono.Android/map.csv`
101+
102+
The left tree view will be populated with every type that has possible constants that require
103+
a decision. Clicking a tree node will show the grid of all constants in the type. The ones
104+
that need to be handled are the ones with `Action` = `None`. (The others are shown because
105+
sometimes the correct action is to add a new constant to an existing enum.)
106+
107+
Select the row(s) containing the constants you want to act on. (Use Control and Shift to select
108+
multiple rows.) There are 3 possible options for constants:
109+
110+
1) Ignore
111+
112+
If the constant(s) should not be part of an enum (like `Math.PI`), click the `Ignore` toolbar
113+
button to leave them as constants.
114+
115+
2) Add to existing enum
116+
117+
If the constant(s) should be added to an existing enum:
118+
- Click the `Add to existing enum` toolbar button.
119+
- The dialog will show all other enums in this type
120+
- Choose the existing enum to add the new constant(s) to
121+
- After accepting the dialog, you may need to click the grid to cause it to refresh
122+
- The constant(s) will be marked as `Enumify` with the `EnumFullType` you specified
123+
- The enum member names may need to be tweaked by changing the `EnumMember` column
124+
125+
3) Create a new enum
126+
127+
If the constant(s) should be added to a brand new enum:
128+
- Click the `Create Enum` toolbar button
129+
- In the dialog, a suggested enum namespace and name will be pre-populated. This may need to be
130+
tweaked as needed.
131+
- Mark `Is Flags` if this should be a `[Flags]` enum type.
132+
- After accepting the dialog, you may need to click the grid to cause it to refresh
133+
- The constant(s) will be marked as `Enumify` with the `EnumFullType` you specified
134+
- The enum member names may need to be tweaked by changing the `EnumMember` column
135+
136+
Once decisions have been made for all new constants in a type, use the left tree view to move
137+
to the next type. You should periodically save your progress with `File` -> `Save` in case
138+
BindingStudio crashes.
139+
140+
The left tree view can be updated by saving and reopening the `map.csv` file.
141+
142+
### Extract methods that possibly need enums
58143

59-
5) enumification
144+
Using BindingStudio:
60145

61-
See `build-tools/enumification-helpers/README`. Usually it takes many days to complete...
146+
- Update the file paths in `MainForm.FindAPILevelMethodsToolStripMenuItem_Click`
147+
- Run BindingStudio and choose `Tools` -> `Find API Level Methods`
62148

63-
Enumification work can be delayed and only the final API has to be enumified.
149+
This will create a file of every method in the new API level that takes an `int` as a parameter
150+
or returns an `int` as a return value. Each method will be marked with a `?` in the file
151+
to indicate a decision needs to be made to ignore it or map it to an enum.
152+
153+
Example:
154+
```
155+
?,32,android/media,AudioAttributes,getSpatializationBehavior,return,
156+
?,32,android/media,AudioAttributes$Builder,setSpatializationBehavior,sb,
157+
```
158+
159+
### Mapping methods
160+
161+
Using BindingStudio:
162+
163+
- Choose `File` -> `Open Constant Map`
164+
- Choose existing `map.csv`: `xamarin-android/src/Mono.Android/map.csv`
165+
- Choose `File` -> `Open Method Map`
166+
- Choose the new `.csv` created in the previous step
167+
168+
The left tree will populate with every method that possibly should be enumified and
169+
needs a decision to be made. Clicking a method shows the Android documentation for
170+
the method to help make the decision, as well as an area to input the decision.
171+
172+
Note a method may show up multiple times, once for each parameter or return type
173+
(Parameter Name = "return") that is an int. Each one may require a different action.
174+
175+
There are 3 possible options for a method parameter/return type:
176+
177+
1) Unknown
178+
179+
You don't how to handle this method currently, so leaving it in the initial state
180+
of "Unknown" will leave it alone until a decision can be made.
181+
182+
2) Ignore
183+
184+
The method parameter/return type should remain an `int` and not be converted to an enum.
185+
186+
Ex:
187+
```
188+
int Add (int value1, int value2) { ... }
189+
```
190+
191+
Click the "Ignore" radio button and then the "Save" button.
192+
193+
3) Enumify
194+
195+
The method parameter/return type should be changed to an enum.
196+
197+
Ex:
198+
```
199+
void AudioAttributesBuilder.SetSpatializationBehavior (int sb) { ... }
200+
```
201+
202+
- Choose the "Enumify" radio option
203+
- Use the DropDown in the middle to select the enum to use
204+
- When selected, the members of that enum will be shown in the box below the enum
205+
- Alternatively, search for a enum by enum member name using the Search box in the right
206+
- If desired enum is found, clicking it will populate dropdown
207+
- Click "Save"
208+
209+
Use `File` -> `Save` to save your work often!
210+
211+
### Finishing the method map
212+
213+
The official `methodmap.csv` uses a slightly different format than the one used for enumification.
214+
215+
Using BindingStudio:
216+
- Ensure the "new api level method map" CSV file is loaded.
217+
- Choose `Tools` -> `Export Final Method Map`
218+
- Choose a temporary file name
219+
- Open the temporary file, copy the contents to the bottom of the official:
220+
- xamarin-android/src/Mono.Android/methodmap.csv
221+
222+
Congrats! Enumification is complete!
223+
224+
---- Somewhat outdated docs below, update when we do this year's stabilization ----
64225

65226
6) new AndroidManifest.xml elements and attributes
66227

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class CheckApiCompatibility : Task
2929
{ "v10.0", "v9.0" },
3030
{ "v11.0", "v10.0" },
3131
{ "v12.0", "v11.0" },
32-
{ "v12.0.99", "v12.0" },
32+
{ "v12.1", "v12.0" },
3333
};
3434

3535
static readonly string assemblyToValidate = "Mono.Android.dll";

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/GenerateSupportedPlatforms.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ public class GenerateSupportedPlatforms : Task
3131
[Required]
3232
public int MinimumApiLevel { get; set; }
3333

34+
/// <summary>
35+
/// Default value for $(TargetPlatformVersion), defaults to MaxStableVersion.ApiLevel
36+
/// </summary>
37+
public int TargetApiLevel { get; set; }
38+
3439
public override bool Execute ()
3540
{
3641
var versions = new AndroidVersions (AndroidApiInfo.Select (ToVersion));
42+
int targetApiLevel = TargetApiLevel > 0 ? TargetApiLevel : versions.MaxStableVersion.ApiLevel;
3743
var settings = new XmlWriterSettings {
3844
OmitXmlDeclaration = true,
3945
Indent = true,
@@ -56,7 +62,7 @@ public override bool Execute ()
5662
writer.WriteEndElement (); // </TargetPlatformSupported>
5763
writer.WriteStartElement ("TargetPlatformVersion");
5864
writer.WriteAttributeString ("Condition", " '$(TargetPlatformVersion)' == '' ");
59-
writer.WriteString (versions.MaxStableVersion.ApiLevel.ToString ("0.0", CultureInfo.InvariantCulture));
65+
writer.WriteString (targetApiLevel.ToString ("0.0", CultureInfo.InvariantCulture));
6066
writer.WriteEndElement (); // </TargetPlatformVersion>
6167
writer.WriteStartElement ("AndroidMinimumSupportedApiLevel");
6268
writer.WriteAttributeString ("Condition", " '$(AndroidMinimumSupportedApiLevel)' == '' ");

build-tools/api-merge/merge-configuration.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<File Path="api-29.xml.in" Level="29" />
2121
<File Path="api-30.xml.in" Level="30" />
2222
<File Path="api-31.xml.in" Level="31" />
23-
<File Path="api-Sv2.xml.in" Level="Sv2" />
23+
<File Path="api-32.xml.in" Level="32" />
2424
</Inputs>
2525
<Outputs>
2626
<File Path="android-19\mcw\api.xml" LastLevel="19" />
@@ -36,6 +36,6 @@
3636
<File Path="android-29\mcw\api.xml" LastLevel="29" />
3737
<File Path="android-30\mcw\api.xml" LastLevel="30" />
3838
<File Path="android-31\mcw\api.xml" LastLevel="31" />
39-
<File Path="android-Sv2\mcw\api.xml" LastLevel="Sv2" />
39+
<File Path="android-32\mcw\api.xml" LastLevel="32" />
4040
</Outputs>
4141
</Configuration>

build-tools/api-xml-adjuster/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
1717
RUNTIME = mono --debug
1818
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
1919
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
20-
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Sv2
20+
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
2121

2222
XML_OUTPUT_DIR = .
2323

build-tools/create-packs/Directory.Build.targets

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
<_NuGetSources Include="$(OutputPath.TrimEnd('\'))" />
121121
<_PreviewPacks Condition=" '$(AndroidLatestStableApiLevel)' != '$(AndroidLatestUnstableApiLevel)' " Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Ref.$(AndroidLatestUnstableApiLevel).*.nupkg" />
122122
<_InstallArguments Include="android-aot" />
123+
<!-- NOTE: temporary if $(AndroidDefaultTargetDotnetApiLevel) is not 32 -->
124+
<_InstallArguments Include="android-32" />
123125
<_InstallArguments Include="android-$(AndroidLatestUnstableApiLevel)" Condition=" '@(_PreviewPacks->Count())' != '0' " />
124126
<_InstallArguments Include="--skip-manifest-update" />
125127
<_InstallArguments Include="--verbosity diag" />

build-tools/create-packs/Microsoft.Android.Sdk.proj

+10-5
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,23 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
120120
<PropertyGroup>
121121
<AndroidNETSdkVersion>$(AndroidPackVersionLong)</AndroidNETSdkVersion>
122122
<XamarinAndroidVersion>$(AndroidPackVersionLong)</XamarinAndroidVersion>
123-
<_AndroidRuntimePackId Condition=" '%24(TargetPlatformVersion)' != '$(AndroidLatestUnstableApiLevel).0' ">$(AndroidLatestStableApiLevel)</_AndroidRuntimePackId>
124-
<_AndroidRuntimePackId Condition=" '%24(TargetPlatformVersion)' == '$(AndroidLatestUnstableApiLevel).0' ">$(AndroidLatestUnstableApiLevel)</_AndroidRuntimePackId>
123+
</PropertyGroup>
124+
<PropertyGroup Condition=" '%24(TargetPlatformVersion)' == '31.0' ">
125+
<_AndroidRuntimePackId>31</_AndroidRuntimePackId>
126+
<_AndroidRuntimePackVersion>31.0.101-preview.11.117</_AndroidRuntimePackVersion>
127+
</PropertyGroup>
128+
<PropertyGroup>
129+
<_AndroidRuntimePackId Condition=" '%24(_AndroidRuntimePackId)' == '' ">$(AndroidLatestStableApiLevel)</_AndroidRuntimePackId>
130+
<_AndroidRuntimePackVersion Condition=" '%24(_AndroidRuntimePackVersion)' == '' ">**FromWorkload**</_AndroidRuntimePackVersion>
125131
</PropertyGroup>
126132
<ItemGroup>
127133
<KnownFrameworkReference
128134
Include="Microsoft.Android"
129135
TargetFramework="$(_AndroidNETAppTargetFramework)"
130136
RuntimeFrameworkName="Microsoft.Android"
131-
DefaultRuntimeFrameworkVersion="**FromWorkload**"
132-
LatestRuntimeFrameworkVersion="**FromWorkload**"
137+
LatestRuntimeFrameworkVersion="%24(_AndroidRuntimePackVersion)"
133138
TargetingPackName="Microsoft.Android.Ref.%24(_AndroidRuntimePackId)"
134-
TargetingPackVersion="**FromWorkload**"
139+
TargetingPackVersion="%24(_AndroidRuntimePackVersion)"
135140
RuntimePackNamePatterns="Microsoft.Android.Runtime.%24(_AndroidRuntimePackId).**RID**"
136141
RuntimePackRuntimeIdentifiers="@(_AndroidNETAppRuntimePackRids, '%3B')"
137142
Profile="Android"

build-tools/scripts/XABuildConfig.cs.in

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Xamarin.Android.Tools
1010
public const string NDKRelease = "@NDK_RELEASE@";
1111
public const int NDKMinimumApiAvailable = @NDK_MINIMUM_API_AVAILABLE@;
1212
public const int AndroidLatestStableApiLevel = @ANDROID_LATEST_STABLE_API_LEVEL@;
13+
public const int AndroidDefaultTargetDotnetApiLevel = @ANDROID_DEFAULT_TARGET_DOTNET_API_LEVEL@;
1314
public static readonly Version NDKVersion = new Version (@NDK_VERSION_MAJOR@, @NDK_VERSION_MINOR@, @NDK_VERSION_MICRO@);
1415

1516
public static readonly Dictionary <string, int> ArchAPILevels = new Dictionary <string, int> (StringComparer.Ordinal) {

0 commit comments

Comments
 (0)