Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop KitKat support #1751

Closed
DanAlbert opened this issue Aug 17, 2022 · 5 comments
Closed

Drop KitKat support #1751

DanAlbert opened this issue Aug 17, 2022 · 5 comments
Assignees

Comments

@DanAlbert
Copy link
Member

DanAlbert commented Aug 17, 2022

Description

This will be added to changelogs as appropriate, but filing as an announcement that this is on our near term schedule. The current plan is for NDK r25 (2022 LTS) to be the last release that supports KitKat (APIs 19 and 20). NDK r26 (2023 LTS, so not until next summer) will not support minSdkVersions below 21 (Lollipop). Exact releases are subject to change if we discover unexpected costs.

Dropping KitKat will have greater benefits than the other API levels we've dropped support for over the years (and while not the only reason, one motivation for the prior support removals was getting us closer to being able to drop 19/20):

  1. libandroid_support will no longer be needed.
    1. libandroid_support adds to the APK size for all apps. Even if your minSdkVersion is 21+, libc++ is built for the lowest API level supported by the NDK, so it includes some pieces of libandroid_support.
    2. libandroid_support subtly alters the behavior of some libc functions.
    3. libandroid_support prevents APIs from being exposed as weak symbols for APIs in libc. libandroid_support requires preprocessing those headers to add explicit #if __ANDROID_API__ >= ... guards around APIs that makes even the weak symbols mode unable to see those APIs.
    4. libandroid_support would need to be upstreamed to LLVM to improve libc++ maintainability. I doubt LLVM wants that mess.
    5. libandroid_support prevents good diagnostics from being emitted for some APIs. libandroid_support's only goal is to make libc++ usable for API levels older than 21. Sometimes this means it provides a decl but no implementation. When libc++ is not used (rare for C++ apps), the libandroid_support headers are still used even if the library will not be linked. In either of these cases, the build will have a linker error rather than a compile error, which is misleading.
    6. libandroid_support complicates build system implementations.
  2. libc received insufficient investment before API 21. Dropping KitKat support should enable removal of old workarounds in NDK and user code. Rust in particular has many workarounds for KitKat that they're keen to drop.
  3. Testing will benefit. Devices old enough to run KitKat are dying out, and emulation of those is not reliable IME.
  4. Behavioral differences between ABIs will be reduced. 64-bit code has always had a minSdkVersion of 21, regardless of the app's actual minSdkVersion, as that was the first API level that supported 64-bit. Compiling all the ABIs in the app with the same minSdkVersion (especially since none will need libandroid_support as a result) will reduce behavioral fragmentation.

Changes implementing this support removal will land in our development branches very soon so we can continue working on testing weak symbol APIs, and verify that there are no unexpected consequences to dropping libandroid_support.

The cost of this change is that apps compiled using NDK r26+ will have a maximum reach <1% smaller. APIs 19 and 20 comprise less than 1% of the device population today, and that is expected to drop more by the time r26 is a stable release (about a year from now). This will likely mean a lower proportional impact than even the other API level drops we've done in the past, with stronger benefits than those earlier support removals. If KitKat users are critical to your app, you will need to continue using NDK r25 to reach those users, but note that r25 reached EOL some time next summer (not before 13 July 2023).

@DanAlbert DanAlbert self-assigned this Aug 17, 2022
@DanAlbert DanAlbert moved this to Triaged in NDK r26 Aug 17, 2022
@enh-google
Copy link
Collaborator

1 iii isn't that many though, right, and mostly uninteresting stuff?

$ nm libandroid_support.a | grep -w T
00000000 T c32rtomb
00000000 T duplocale
00000000 T freelocale
00000000 T localeconv
00000000 T newlocale
00000000 T setlocale
00000000 T uselocale
00000000 T _Z22__ctype_get_mb_cur_maxv
00000000 T mbrtoc32
00000000 T mbrtowc
00000000 T mbsinit
00000000 T mbsnrtowcs
00000000 T mbsrtowcs
00000000 T wcrtomb
00000000 T wcsnrtombs
00000000 T wcsrtombs
00000000 T mbtowc
00000000 T wcstombs
00000000 T mbstowcs
00000000 T strtold_l
00000000 T strtoll_l
00000000 T strtoull_l
00000000 T swprintf
00000000 T vswprintf
00000000 T wcstod
00000000 T wcstof
00000000 T wcstoimax
00000000 T wcstol
00000000 T wcstoll
00000000 T wcstoul
00000000 T wcstoull
00000000 T wcstoumax

if you drop the wcs* stuff and the locale stuff, you're left with just the utf-8 <-> wchar_t stuff:

00000000 T c32rtomb
00000000 T mbrtoc32
00000000 T mbrtowc
00000000 T mbsinit
00000000 T mbsnrtowcs
00000000 T mbsrtowcs
00000000 T wcrtomb
00000000 T wcsnrtombs
00000000 T wcsrtombs
00000000 T mbtowc
00000000 T wcstombs
00000000 T mbstowcs

that's probably the least motivating item on the list?

@DanAlbert
Copy link
Member Author

I actually explained that poorly. Because of the APIs in libandroid_support, we can't support weak APIs for anything in libc (because it all goes through versioner, which adds guards for everything).

@DanAlbert
Copy link
Member Author

Reworded that bullet point so it's more accurate.

JarlPenguin pushed a commit to AOSP-on-montana/platform_build_soong that referenced this issue Aug 22, 2022
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Repository owner moved this from Triaged to Merged in NDK r26 Oct 19, 2022
@truboxl
Copy link

truboxl commented Oct 20, 2022

I guess #1651 is no longer being worked on?

@DanAlbert
Copy link
Member Author

Had missed that one. Closed. Thanks!

osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
Bug: android/ndk#1751
Test: None
Change-Id: I32c939b196e1119b31625665328e3039aa893508
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
To prepare for dropping kitkat support, make sure our tests are all
behaving on API 21.

With the exception of ASan, all the changes here were to fix test bugs,
not actual bugs. ASan still needs to be investigated, but I suspect that
one is also a test bug (missing LD_PRELOAD).

Bug: android/ndk#1751
Test: treehugger
Change-Id: I59462c8d046b4aac17fd36f5ab1831867ff02cbe
osspop pushed a commit to osspop/android-ndk that referenced this issue Jan 17, 2023
Bug: android/ndk#1751
Test: treehugger
Change-Id: I52c45663a8fb997cc8b8e3955e4843772c881792
jrguzman-ms pushed a commit to msft-mirror-aosp/toolchain.llvm-project that referenced this issue Jan 24, 2023
Not needed now that we no longer support kitkat.

Bug: android/ndk#1751
Test: treehugger
Change-Id: If85a6532f4c7c23b4e354efdef76e94c09e9be56
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Feb 6, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Feb 6, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Feb 6, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Feb 16, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Mar 19, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
canyie added a commit to canyie/pine that referenced this issue May 1, 2023
According to android/ndk#1751 , NDK will only support Android 5.0+ since r26.

To use this project, kitkat users have to turn on developer options, switch to use ART instead of Dalvik. It's so hard for normal users to do so, not to mention there are many Kitkat devices hide the option in their Settings like the TV set-top box I bought last year (F**k, why are these manufacturers still releasing NEW kitkat devices in 2022?!? Maybe even 2023 or 2030... At least my kitkat device still receives system updates from its manufacturer). Maybe Dexposed is just a better choice since it supports Dalvik so users don't have to user a WIP runtime :)

Personally, I don't want to stay at an old NDK version, so I will bump minSdk to 21 as soon as NDK r26 is used; but I know some developers still want to support Kitkat in their projects, so this commit is added. If you still want to support Kitkat, you just need to clone this project, switch to an older NDK, change minSdk to 19, volia!
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Jun 20, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Jul 11, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Tomoms pushed a commit to Tomoms/android_build_soong that referenced this issue Sep 3, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
Gelbpunkt pushed a commit to Kenvyra/android_build_soong that referenced this issue Sep 26, 2023
The NDK is dropping support for this.

Bug: android/ndk#1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
NickGerleman added a commit to NickGerleman/fbjni that referenced this issue Nov 9, 2023
Summary:
facebookincubator@bd94aae bumped to NDK 26 (latest LTS NDK).

NDK 26 [dropped](https://github.com/android/ndk/wiki/Changelog-r26) [support](android/ndk#1751) for KitKat, and NDK 25 already required minSDK 19, so our minSdk of 15 is too low.

This bumps the minSdk, so that when we publish AARs for next fbjni published version, it errors if user is on earlier SDK.

Differential Revision: D51146044
NickGerleman added a commit to NickGerleman/fbjni that referenced this issue Nov 9, 2023
Summary:

facebookincubator@bd94aae bumped to NDK 26 (latest LTS NDK).

NDK 26 [dropped](https://github.com/android/ndk/wiki/Changelog-r26) [support](android/ndk#1751) for KitKat, and NDK 25 already required minSDK 19, so our minSdk of 15 is too low.

This bumps the minSdk, so that when we publish AARs for next fbjni published version, it errors if user is on earlier SDK.

Differential Revision: D51146044
facebook-github-bot pushed a commit to facebookincubator/fbjni that referenced this issue Nov 11, 2023
Summary:
Pull Request resolved: #91

bd94aae bumped to NDK 26 (latest LTS NDK).

NDK 26 [dropped](https://github.com/android/ndk/wiki/Changelog-r26) [support](android/ndk#1751) for KitKat, and NDK 25 already required minSDK 19, so our minSdk of 15 is too low.

This bumps the minSdk, so that when we publish AARs for next fbjni published version, it errors if user is on earlier SDK.

Reviewed By: rshest

Differential Revision: D51146044

fbshipit-source-id: de1b38de0f2bd0afe9ed7ac074eaf7eb07903d40
rooteduniverse1003 pushed a commit to rooteduniverse1003/Android-Platform-NDK that referenced this issue Nov 22, 2023
ndk-stack was moved to being a zipapp, which changed the path of
__file__ relative to the root of the NDK.

This was covered by a test (97% line coverage, even), but the test was
useless because it was only testing mocks, and the mocks weren't
updated.

The "system test" has been updated to test the real ndk-stack entry
point in the NDK rather than importing the source and mocking dependency
discovery. This unfortunately means that running the tests now depends
on more or less the whole NDK, but that's true of everything else in the
tests/ directory anyway. If that's ever a problem, we should split up
the tests so that the test of the NDK itself and the tests of the ndk
python package are kept separately.

Bug: android/ndk#1751
Test: fixed the test, also tested manually
(cherry picked from https://android-review.googlesource.com/q/commit:a54b719d892e8d19fe0ee9218762f0d9093c88f1)
Merged-In: I77076d1c3fc8ac5a05a93dbe1ce3488874283143
Change-Id: I77076d1c3fc8ac5a05a93dbe1ce3488874283143
tdf-gerrit pushed a commit to LibreOffice/core that referenced this issue Dec 8, 2023
NDK 26 dropped support for API levels < 21 [1] [2].
Do the same for our Android build, to ease the
maintenance.

Adapt configure.ac accordingly and drop the
now obsolete code paths in Android Viewer
Java code.

This in also means that the same minSdkVersion will
be used for all architectures now, while API level 21
was already used for the 64-bit variants (for which
the minimum supported version was 21 anyway) and
API level 19 was used for x86 and 32-bit ARM when
building with NDK 24/25, API level 16 when building
with NDK 23.

According to [1] and [3], more than 99% of
Android devices have at least Android version 5,
i.e. support API level 21.

[1] android/ndk#1751
[2] https://developer.android.com/ndk/downloads/revision_history
[3] https://apilevels.com/

Change-Id: I875e784dd4e62993f51059ae6a280d425cb49c0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160334
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Merged
Development

No branches or pull requests

3 participants