Skip to content

Conversation

@grendello
Copy link
Contributor

@grendello grendello commented Apr 20, 2020

Up until this commit, we have been building the 64-bit targets (x86-64
and armv8-a against NDK API 21 while the 32-bit targets (x86 and
armv7-a) against NDK API 16. This commit changes it so that all
targets build against API 21. This gives us the ability to speed up
Debug builds on 32-bit platforms via use of POSIX APIs for directory
traversal that are available starting from API 21 onwards (openat and
fstatat). The switch to API 21 was initially planned for .NET5 but
there's no harm in making the change now.

In addition, this commit updates versions of several components:

  • Bump emulator version to 30.0.5
  • Bump NDK version to 21b (21.1.6352462)
  • Bump x86 system image revision to 7

Also, XABuildConfig.NDKMinimumApiAvailable is now set to the minimum
supported NDK API level instead of the minimum API level installed by
the NDK.

@brendanzagaeski
Copy link
Contributor

Questions (based on previous similar change in Xamarin.Android 9.3)

Will the changes in this PR also automatically update the warning message for XA4216? It looks like an equivalent question is: Will the changes automatically update the NDKMinimumApiAvailable output from Xamarin.Android.BuildTools.PrepTasks.NDKInfo?

Draft release note

Here's a candidate release note for this change based on the release note for a previous update of the minimum compatible API level. Feel free to suggest changes or even a whole new wording.

### Minimum compatible Android version now Android 5.0 Lollipop (API level 21)

The minimum compatible Android version for Xamarin.Android apps is now Android
5.0 Lollipop (API level 21).  Warning XA4216 has been updated to help highlight
this change for any projects that might still have an older version set for the
`minSdkVersion` in the `AndroidManifest.xml` file:

```
warning XA4216: AndroidManifest.xml //uses-sdk/@android:minSdkVersion '20' is less than API-21, this configuration is not supported.
```

#### Background information

The unmanaged native libraries that are part of Xamarin.Android are now built to
target Android 5.0 Lollipop (API level 21), so apps built using this release can
abort due to incompatible APIs if run on earlier Android versions.

@grendello
Copy link
Contributor Author

Questions (based on previous similar change in Xamarin.Android 9.3)

Will the changes in this PR also automatically update the warning message for XA4216? It looks like an equivalent question is: Will the changes automatically update the NDKMinimumApiAvailable output from Xamarin.Android.BuildTools.PrepTasks.NDKInfo?

The warning message will be updated automatically, yes - it uses a file generated by xaprepare which stores the minimum values. This PR is irrelevant for NKInfo which gathers information about the installed NDK - i.e. what's available on the system.

Copy link
Contributor

@brendanzagaeski brendanzagaeski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried out the .vsix from this PR. It looks like the XA4216 build warning does not yet appear for android:minSdkVersion below 21 with that .vsix.

Maybe it would be OK to change the way NDKMinimumApiAvailable is defined to match the values from NdkMinimumAPI? At the moment, NDKMinimumApiAvailable is still 16:

ildasm /ITEM=Xamarin.Android.Tools.XABuildConfig::NDKMinimumApiAvailable Xamarin.Android.Build.Tasks.dll

shows:

.field public static literal int32 NDKMinimumApiAvailable = int32(0x00000010)

new AndroidPlatformComponent ("platform-R_r02", apiLevel: "R", pkgRevision: "2"),
new AndroidPlatformComponent ("platform-28_r06", apiLevel: "28", pkgRevision: "6"),
new AndroidPlatformComponent ("platform-29_r04", apiLevel: "29", pkgRevision: "4"),
new AndroidPlatformComponent ("platform-R_r03", apiLevel: "R", pkgRevision: "3"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not update API-R to Developer Preview 3, please. This should be done separately, as there's no guarantee that it's API compatible with DP2.

@grendello grendello force-pushed the api21-for-all branch 7 times, most recently from ab1aa68 to 166604c Compare April 27, 2020 10:24
@grendello
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grendello grendello force-pushed the api21-for-all branch 3 times, most recently from d84a7b0 to 97b5183 Compare April 28, 2020 19:13
@grendello grendello force-pushed the api21-for-all branch 5 times, most recently from 168e467 to e3ce249 Compare April 29, 2020 20:41
Copy link
Contributor

@brendanzagaeski brendanzagaeski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for both the release note and the updated behavior of the XA4216 warning. Thanks!

I checked the latest .vsix from this PR and verified that NDKMinimumApiAvailable is now 21 and that the XA4216 warning now appears as expected when android:minSdkVersion is less than 21. Looks good.

Up until this commit, we have been building the 64-bit targets (`x86-64`
and `armv8-a` against NDK API 21 while the 32-bit targets (`x86` and
`armv7-a`) against NDK API 16.  This commit changes it so that all
targets build against API 21.  This gives us the ability to speed up
Debug builds on 32-bit platforms via use of  POSIX APIs for directory
traversal that are available starting from API 21 onwards (`openat` and
`fstatat`).  The switch to API 21 was initially planned for .NET5 but
there's no harm in making the change now.

In addition, this commit updates versions of several components:

  * Bump emulator version to 30.0.5
  * Bump NDK version to 21b (21.1.6352462)
  * Bump x86 system image revision to 7

Also, `XABuildConfig.NDKMinimumApiAvailable` is now set to the minimum
supported NDK API level instead of the minimum API level *installed* by
the NDK.
@jonpryor jonpryor merged commit a648981 into dotnet:master Apr 30, 2020
@grendello grendello deleted the api21-for-all branch April 30, 2020 18:13
jonpryor pushed a commit that referenced this pull request May 6, 2020
Previously, we built the 64-bit targets (`x86-64` and `arm64-v8a`)
against NDK API-21 and the32-bit targets (`x86` and `armeabi-v7a`)
against NDK API-16.

Update so that all targets build against API-21.

This gives us the ability to speed up on-device app startup of Debug-
configuration builds on 32-bit platforms by using POSIX APIs for
directory traversal that are available starting from API-21 onwards
([**openat**(2)][0] and [**fstatat**(2)][1]).

The switch to API-21 was initially planned for .NET5 but there's no
significant harm in making the change now.

In addition, this commit updates versions of several components:

  * Bump emulator version to 30.0.5
  * Bump NDK version to 21b (21.1.6352462)
  * Bump x86 system image revision to 7

Also, `XABuildConfig.NDKMinimumApiAvailable` is now set to the minimum
supported NDK API level instead of the minimum API level *installed*
by the NDK.

TODO: This commit knowingly breaks some unit tests, e.g.
`Xamarin.Android.Build.Tests.BuildTest.BuildMultiDexApplication()`.
These will be fixed in a later commit.

[0]: https://linux.die.net/man/2/openat
[1]: https://linux.die.net/man/2/fstatat
grendello added a commit to grendello/xamarin-android that referenced this pull request Jun 5, 2020
grendello added a commit to grendello/xamarin-android that referenced this pull request Jun 5, 2020
grendello added a commit to grendello/xamarin-android that referenced this pull request Jun 5, 2020
Context: https://docs.microsoft.com/en-us/xamarin/get-started/supported-platforms?tabs=windows
Context: https://github.com/dotnet/maui#xamarinforms-vs-net-maui

This reverts commit a648981.

Xamarin.Forms advertises a supported minimum API level of API-19,
which commit a648981 removed support for.  This change complicates
the life of the Xamarin.Forms team.

We will eventually drop support for API-19 -- certainly as part of
.NET 5/6 -- but for now preserve API-19 compatibility.
jonpryor pushed a commit that referenced this pull request Jun 5, 2020
Context: https://docs.microsoft.com/en-us/xamarin/get-started/supported-platforms?tabs=windows
Context: https://github.com/dotnet/maui#xamarinforms-vs-net-maui

This reverts commit a648981.

Xamarin.Forms advertises a supported minimum API level of API-19,
which commit a648981 removed support for.  This change complicates
the life of the Xamarin.Forms team.

We will eventually drop support for API-19 -- certainly as part of
.NET 5/6 -- but for now preserve API-19 compatibility.
jonpryor pushed a commit that referenced this pull request Jun 5, 2020
Context: https://docs.microsoft.com/en-us/xamarin/get-started/supported-platforms?tabs=windows
Context: https://github.com/dotnet/maui#xamarinforms-vs-net-maui

This reverts commit a648981.

Xamarin.Forms advertises a supported minimum API level of API-19,
which commit a648981 removed support for.  This change complicates
the life of the Xamarin.Forms team.

We will eventually drop support for API-19 -- certainly as part of
.NET 5/6 -- but for now preserve API-19 compatibility.
@brendanzagaeski brendanzagaeski removed this from the In Preview: 10.4 (d16-7) milestone Jun 23, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants