Skip to content

Conversation

@jonpryor
Copy link
Contributor

Context: dotnet/android#10438

9 months ago in The First Developer Preview of Android 16:

Two Android API releases in 2025

  • This preview is for the next major release of Android with a
    planned launch in Q2 of 2025. This release is similar to all of
    our API releases in the past, where we can have planned
    behavior changes that are often tied to a targetSdkVersion.

  • We plan to have another release in Q4 of 2025 which also will
    include new developer APIs. The Q2 major release will be the
    only release in 2025 to include planned behavior changes that
    could affect apps.

The 3rd bullet point is a "25Q4 MINOR SDK RELEASE" , thus introducing the concept of a "minor" SDK version, with semantics:

  • <uses-sdk/>:

    It's not possible to specify that an app either targets or
    requires a minor SDK version.

  • Using new APIs with major and minor releases:

    The new SDK_INT_FULL constant can be used for API checks…

    if (SDK_INT_FULL >= VERSION_CODES_FULL.[MAJOR or MINOR RELEASE]) {
      // Use APIs introduced in a major or minor release
    }
    

    You can also use the Build.getMinorSdkVersion() method to
    get just the minor SDK version:

    minorSdkVersion = Build.getMinorSdkVersion(Build.VERSION_CODES_FULL.BAKLAVA);
    

Update AndroidVersion and AndroidVersions to better support the concept of "minor SDK releases":

  • Add a new AndroidVersion.VersionCodeFull property, which is a System.Version -- not an int -- for which Version.Major matches AndroidVersion.ApiLevel.

  • Add a new internal AndroidVersion.Ids property, which is the= full set of "aliases" that should be checked when doing an "id" match. This simplifies AndroidVersions logic.

    Ids contains: ApiLevel, VersionCodeFull, and Id`.

  • Change AndroidVersions.AlternateIds into a set-only property which updates AndroidVersion.Ids.

  • Bump $(LangVersion)=9.0 to use target-typed new().

Context: dotnet/android#10438

9 months ago in [The First Developer Preview of Android 16][0]:

> **Two Android API releases in 2025**
>
>   * This preview is for the next major release of Android with a
>     planned launch in Q2 of 2025. This release is similar to all of
>     our API releases in the past, where we can have planned
>     behavior changes that are often tied to a targetSdkVersion.
>
>   * …
>
>   * We plan to have another release in Q4 of 2025 which also will
>     include new developer APIs. The Q2 major release will be the
>     only release in 2025 to include planned behavior changes that
>     could affect apps.

The 3rd bullet point is a "25Q4 MINOR SDK RELEASE" , thus introducing
the *concept* of a "minor" SDK version, with semantics:

  * [`<uses-sdk/>`][3]:

    > It's not possible to specify that an app either targets or
    > requires a minor SDK version.

  * [Using new APIs with major and minor releases][4]:

    > The new [`SDK_INT_FULL`][5] constant can be used for API checks…
    >
    >     if (SDK_INT_FULL >= VERSION_CODES_FULL.[MAJOR or MINOR RELEASE]) {
    >       // Use APIs introduced in a major or minor release
    >     }
    >
    > You can also use the [`Build.getMinorSdkVersion()`][6] method to
    > get just the minor SDK version:
    >
    >     minorSdkVersion = Build.getMinorSdkVersion(Build.VERSION_CODES_FULL.BAKLAVA);

Update `AndroidVersion` and `AndroidVersions` to better support the
concept of "minor SDK releases":

  * Add a new `AndroidVersion.VersionCodeFull` property, which is a
    `System.Version` -- not an `int` -- for which `Version.Major`
    matches `AndroidVersion.ApiLevel`.

  * Add a new internal `AndroidVersion.Ids` property, which is the=
    full set of "aliases" that should be checked when doing an "id"
    match.  This simplifies `AndroidVersions` logic.

    `Ids` contains: `ApiLevel`, VersionCodeFull`, and `Id`.

  * Change `AndroidVersions.AlternateIds` into a set-only property
    which updates `AndroidVersion.Ids`.

  * Bump `$(LangVersion)`=9.0 to use target-typed `new()`.

[0]: https://android-developers.googleblog.com/2024/11/the-first-developer-preview-android16.html
[3]: https://developer.android.com/guide/topics/manifest/uses-sdk-element
[4]: https://developer.android.com/about/versions/16/features#using-new
[5]: https://developer.android.com/reference/android/os/Build.VERSION#SDK_INT_FULL
[6]: https://developer.android.com/reference/android/os/Build#getMinorSdkVersion(int)
@jonathanpeppers jonathanpeppers merged commit 31609ca into dotnet:main Aug 25, 2025
2 checks passed
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 25, 2025
Context: dotnet/android-tools@31609ca

Changes: dotnet/android-tools@c4cb3db...31609ca

  * dotnet/android-tools@31609ca: [Xamarin.Android.Tools.AndroidSdk] "Minor" SDK version support (dotnet/android-tools#261)

@jonathanpeppers [noted][0]:

> We could maybe extend the type here and add a property?
>
> But then `AndroidVersion` also needs updates for any other software using it.

dotnet/android-tools@31609cac updates `AndroidVersion` and
`AndroidVersions` to better support the concept of "minor" SDK versions,
allowing lookup via "minor" version on
`AndroidVersions.GetIdFromApiLevel(string)`.  This would allow
`MonoAndroidHelper.SupportedVersions.GetIdFromApiLevel("36.1")` to
find CANARY, if and when appropriate.

Update `GenerateSupportedPlatforms.cs` to look at
`AndroidVersion.VersionCodeFull` instead of `AndroidVersion.ApiLevel`.
This allows minor SDK versions to be present in
`@(AndroidSdkSupportedTargetPlatformVersion)`.

Update `GeneratedMonoAndroidProjitemsFile.cs` so that the generated
`bin\Build$(Configuration)\Mono.Android.Apis.projitems` file contains
`%(AndroidApiInfo.VersionCodeFull)` item metadata.

Update `Mono.Android.targets` so that the generated `AndroidApiInfo.xml`
file contains `<VersionCodeFull/>`, based on `%(VersionCodeFull)`.

[0]: dotnet#10438 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants