mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
475 stars 132 forks source link

Compile for Android with support for 16 KB page sizes #2448

Closed AndriiYanechko closed 2 weeks ago

AndriiYanechko commented 3 months ago

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
jush commented 3 months ago

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.

kiryldz commented 2 weeks ago

This is implemented in v11.7.X versions. Example how to fetch it: implementation 'com.mapbox.maps:android-ndk27:11.7.1'.

PavlosTze commented 1 week ago

@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 commented 1 week ago

@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' ?

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.

PavlosTze commented 1 week ago

@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' ?

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.

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.

PavlosTze commented 1 week ago

FYI task reference here: https://github.com/mapbox/mapbox-maps-android/issues/2506

kiryldz commented 1 week ago

@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' ?

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.

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.