You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: dotnet/android#4873
Context: dotnet/android#4873 (comment)
When xamarin-android is built to support .NET 5, the .NET 5 install
directory contains a single `AndroidApiInfo.xml` file:
<AndroidApiInfo>
<Id>30</Id>
<Level>30</Level>
<Name>R</Name>
<Version>v11.0</Version>
<Stable>True</Stable>
</AndroidApiInfo>
`AndroidVersions`, meanwhile, is setup to read a *set* of
`AndroidApiInfo.xml` files (aad97f1) to "dynamically" compute mappings
between possible `$(TargetFrameworkVersion)` values, API-levels, and
IDs for those API levels.
When there is only one such file, if you call:
int? apiLevel = androidVersions.GetApiLevelFromId (29);
then `apiLevel` will always be `null`, because (at present)
`AndroidVersions.KnownVersions` doesn't know about API-29 or API-30.
We *could* update `AndroidVersions.KnownVersions` to contain entries
for API-29 & API-30, but doing so means that we reintroduce the
scenario that `AndroidVersions` was added to help defend against: a
need/requirement to update `AndroidVersions.KnownVersions` *every time*
a new API level was released, lest ~everything break.
We *don't* want to require `AndroidVersions.KnownVersions` updates.
To allow a .NET 5-like environment to work *without* updating
`KnownVersions`, update the various `GetApiLevelFromId()` methods to
return the incoming API level as a fallback. If `"29"` comes in, then
`29` can be returned and assumed to be a valid API level.
0 commit comments