mapbox-maps-android
mapbox-maps-android copied to clipboard
Compile for Android with support for 16 KB page sizes
New Feature
I'm encountering an issue when I'm running the app on the Android 15 with 16 KB page size and see some native issues. Is there any plans to recompile library to resolve this issue ?
Beginning with Android 15, Android supports devices that are configured to use a page size of 16 KB (16 KB devices). If your app uses any NDK libraries, either directly or indirectly through an SDK, then you will need to rebuild your app for it to work on these 16 KB devices.
https://developer.android.com/guide/practices/page-sizes#compile-16-kb-alignment
Why
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~yeqHYQLP2OTCXPdQnUQZJw==/XXXX-gZF5_v1OEhaH0PnZQDkfvg==/lib/arm64/libc++_shared.so" (new hash type from the future?)
at java.lang.Runtime.loadLibrary0(Runtime.java:1081)
at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
at java.lang.System.loadLibrary(System.java:1765)
at com.mapbox.common.loader.MapboxLibraryLoader.load(MapboxLibraryLoader.kt:19)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:65)
at com.mapbox.common.CoreInitializer.create(CoreInitializer.kt:8)
at androidx.startup.AppInitializer.doInitialize(AppInitializer
We're actively looking into it but we don't have a concrete timeline at the moment.
Our understanding is that no device with Android 15 will have 16kb enabled by default.
Moreover, as stated in https://developer.android.com/about/versions/15/behavior-changes-all#16-kb it won't be mandatory until next year:
We plan to make 16 KB page compatibility required for app uploads to the Google Play store next year.
This is implemented in v11.7.X versions. Example how to fetch it: implementation 'com.mapbox.maps:android-ndk27:11.7.1'.
@kiryldz If we use the implementation 'com.mapbox.maps:android-ndk27:11.7.1', do we also still keep the implementation implementation 'com.mapbox.maps:android:11.7.1' ?
@kiryldz If we use the
implementation 'com.mapbox.maps:android-ndk27:11.7.1', do we also still keep the implementationimplementation 'com.mapbox.maps:android:11.7.1'?
No, com.mapbox.maps:android-ndk27:11.7.1 should replace the default one com.mapbox.maps:android:11.7.1. They are the same in terms of API and starting from 11.7.0 we will always release 2 variants of our SDK. It is up to users to decide which one to use.
@kiryldz If we use the
implementation 'com.mapbox.maps:android-ndk27:11.7.1', do we also still keep the implementationimplementation 'com.mapbox.maps:android:11.7.1'?No,
com.mapbox.maps:android-ndk27:11.7.1should replace the default onecom.mapbox.maps:android:11.7.1. They are the same in terms of API and starting from 11.7.0 we will always release 2 variants of our SDK. It is up to users to decide which one to use.
I see, and except the issue described by the author above, why should someone would choose the NDK version istead of the default one? Sorry, just trying to understand as I'm getting a different crash and understand how that works in order to solve this or open a new issue.
FYI task reference here: https://github.com/mapbox/mapbox-maps-android/issues/2506
@kiryldz If we use the
implementation 'com.mapbox.maps:android-ndk27:11.7.1', do we also still keep the implementationimplementation 'com.mapbox.maps:android:11.7.1'?No,
com.mapbox.maps:android-ndk27:11.7.1should replace the default onecom.mapbox.maps:android:11.7.1. They are the same in terms of API and starting from 11.7.0 we will always release 2 variants of our SDK. It is up to users to decide which one to use.I see, and except the issue described by the author above, why should someone would choose the NDK version istead of the default one? Sorry, just trying to understand as I'm getting a different crash and understand how that works in order to solve this or open a new issue.
There is no practical need to use NDK 27 artifacts now. However Google strongly advises SDK developers to provide NDK 27 support ASAP because in the future there will be devices on the marker which are shipped with 16 Kb page support. Maps SDK is the first Mapbox SDK that has received this support. Noting that we provide NDK 27 support in separate artifacts as in theory misaligned NDKs in end user application might lead to runtime issues.
This is implemented in v11.7.X versions. Example how to fetch it:
implementation 'com.mapbox.maps:android-ndk27:11.7.1'.
I am currently using version 10.18.0 of the library. Could you please let me know if there are any plans to add support for 16 KB page sizes in the 10.x series? If so, do you have an estimated timeline for its release?
@hiteshchopra11 we're actively working on it but there's no timeline I can share at the moment.
@hiteshchopra11 Maps v10.19.0 with 16 Kb support are released.
Thank you so much, @jush and @kiryldz! We’re eagerly awaiting 16kb support for the Mapbox Search SDK, as this issue is currently blocking our progress :)
☝️ Same - https://github.com/mapbox/mapbox-search-android/issues/270
As a reminder, this is going to be mandatory starting November 1st, 2025
https://android-developers.googleblog.com/2025/05/prepare-play-apps-for-devices-with-16kb-page-size.html?m=1
The main SDK dependency still does not appartently support the 16 kB memory page size
@bamsbamx I am not sure what do you mean as "main" artefact. We release NDK 27 builds with 16kb with every release both for v10 and v11 for quite a while. The new artifacts are available by appending -ndk27 to the artifact ID (for example, com.mapbox.maps:android-ndk27:10.19.0).
@bamsbamx I am not sure what do you mean as "main" artefact. We release NDK 27 builds with 16kb with every release both for v10 and v11 for quite a while. The new artifacts are available by appending -ndk27 to the artifact ID (for example,
com.mapbox.maps:android-ndk27:10.19.0).
Yes but other libraries such as the search one, doesn't have an ndk version yet therefore not only we can't use them, we can't use the maps one as well because of conflicts.
@kiryldz I meant the only dependency listed in the official Mapbox docs Step 2: Add Maps SDK Dependencies
dependencies {
...
implementation("com.mapbox.maps:android:11.12.2")
...
}
With this dependency (without using the android-ndk27 version), I get the following warning in Google Play console
Is this mentioned in the Mapbox Android SDK docs? Maybe I missed it.
I am just curious. Why is the 'main' artifact (com.mapbox.maps:android:11.12.2) already compiled with 16 KB support? I mean, shouldn't this one be already compatible, without needing to declare the android-ndk27 version? This can be confusing, generating issues like #2635
Thank you for your attention
@bamsbamx let me answer your question:
- Bumping an NDK is technically a major breaking change as NDK toolchain should be considered as an internal dependency and bumping from NDK 23 to NDK 27 including compilation flags to support 16Kb pages is a pretty big bump. For users having other 3d party libraries with C++ built with NDK 23 bumping our Maps to NDK 27 would result in hard catching runtime crashes due to
libc++_shared.sobeing not aligned. - Our SDK is used not only with the application developers (who mostly distribute apps via Google Play) but also with customers who distribute their applications directly and / or even have custom AOSP (e.g. automotive customers) who do not have this upcoming limitation.
- We have an internal task to update official installation docs about NDK 27 and this is expected to land soon.
@PavlosTze this repo is for Maps only and we track internally updating other components like Search and Navigation.
@kiryldz Nice explanation! Regarding point 1, does this mean that we cannot use NDK 23 compiled libs if we are using NDK 27 compiled Mapbox lib?
- We have an internal task to update official installation docs about NDK 27 and this is expected to land soon.
How has the progress been on this over the last month? We have a need for the NDK 27 Android version to flow into the Flutter SDK. Will both land soon?
When will navigation be supported?
@EvanZch it's already supported in v3.11.0-beta.1. You just need to update your dependencies by appending the -ndk27 postfix.
I've already updated all the things mentioned above, but I'm still getting this error in my application (still not supported 16 KB issue). I think there's something missing in the new build version, or maybe it'll be fixed in the next update?
What i installed in my apps :
Not all library already updated to 16 KB:
- We have an internal task to update official installation docs about NDK 27 and this is expected to land soon.
Hi! Any updates about this? I'm in the same situation as @kevinmf1 and I don't know if I have to configure my build to use ndk-build
@kevinmf1 could you please check your APK with the steps described in https://developer.android.com/guide/practices/page-sizes#alignment-use-script ?
Hi @jush I already check my app with alignment use script provided by Google Team, and here's the result:
Just in case you need clear result, here is:
=== ELF alignment === /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libmapbox-common.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libmapbox-maps.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libSearchCore.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libc++_shared.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libdatastore_shared_counter.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/armeabi-v7a/libyuv-decoder.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libmapbox-common.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libmapbox-maps.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libSearchCore.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libc++_shared.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libdatastore_shared_counter.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86/libyuv-decoder.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libmapbox-common.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libmapbox-maps.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libSearchCore.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libc++_shared.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libdatastore_shared_counter.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libyuv-decoder.so: \e[31mUNALIGNED\e[0m (212) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libmapbox-common.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libmapbox-maps.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libSearchCore.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libc++_shared.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libdatastore_shared_counter.so: \e[32mALIGNED\e[0m (214) /var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libyuv-decoder.so: \e[31mUNALIGNED\e[0m (212) \e[31mFound 12 unaligned libs (only arm64-v8a/x86_64 libs need to be aligned).\e[0m
I hope this issue will be solved as soon as possible, as the max deadline given by Google is in the early November, Thank You.
Thanks @kevinmf1 for providing your output.
From the output I can see that all the required Mapbox libraries are ALIGNED properly.
Please note the last message of your output:
Found 12 unaligned libs (only arm64-v8a/x86_64 libs need to be aligned).
Especially:
only arm64-v8a/x86_64 libs need to be aligned
All the Mapbox libraries for arm64-v8a are aligned:
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libmapbox-common.so: \e[32mALIGNED\e[0m (214)
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libmapbox-maps.so: \e[32mALIGNED\e[0m (214)
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/arm64-v8a/libSearchCore.so: \e[32mALIGNED\e[0m (214)
as well as the x86_64:
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libmapbox-common.so: \e[32mALIGNED\e[0m (214)
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libmapbox-maps.so: \e[32mALIGNED\e[0m (214)
/var/folders/9z/h64l1bx125sblwd2c6qqgykc0000gp/T/app-debug_out_XXXXX.haoIrQVtfR/lib/x86_64/libSearchCore.so: \e[32mALIGNED\e[0m (214)
You seem to have some other dependency (not a Mapbox one) that it is not aligned: libyuv-decoder.so
Hi! We have updated our guidelines to highlight NDK 27 artifacts for 16 KB page size support. Simply add the -ndk27 suffix to artifact ID:
dependencies {
...
implementation("com.mapbox.maps:android-ndk27:11.14.3")
...
}
More information about NDK support for Mapbox Maps SDK can be found here.
HI @natiginfo
I'm testing right now, but i have problem on compilation and duplicate class.
Here is my versions
mapbox = "11.14.3"
mapboxNavigation = "3.11.4"
mapboxDirection = "7.7.0"
mapboxSearch = "2.14.0"
mapbox-maps = { group = "com.mapbox.maps", name = "android-ndk27", version.ref = "mapbox" }
mapbox-extension = { group = "com.mapbox.extension", name = "maps-compose", version.ref = "mapbox" }
mapbox-navigation = { group = "com.mapbox.navigationcore", name = "android", version.ref = "mapboxNavigation" }
mapbox-direction = { group = "com.mapbox.mapboxsdk", name = "mapbox-sdk-services", version.ref = "mapboxDirection" }
mapbox-autocomplete = { group = "com.mapbox.search", name = "place-autocomplete", version.ref = "mapboxSearch" }
mapbox-search = { group = "com.mapbox.search", name = "mapbox-search-android-ui", version.ref = "mapboxSearch" }
I also tested with -ndk27 on extension and search but no success.
I got this to work yesterday. Here is what my toml looks like:
[versions]
mapbox = "11.14.3"
mapboxSearchAndroid = "2.14.0"
[libraries]
mapbox-maps = { module = "com.mapbox.maps:android-ndk27", version.ref = "mapbox" }
extension-maps-compose = { module = "com.mapbox.extension:maps-compose-ndk27", version.ref = "mapbox" }
mapbox-search-android = { module = "com.mapbox.search:mapbox-search-android-ndk27", version.ref = "mapboxSearchAndroid" }