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

recompile objectbox with the new ndk and enable 16k page support #1178

Open
andrew-ld opened this issue May 16, 2024 · 19 comments
Open

recompile objectbox with the new ndk and enable 16k page support #1178

andrew-ld opened this issue May 16, 2024 · 19 comments
Labels
enhancement New feature or request

Comments

@andrew-ld
Copy link

andrew-ld commented May 16, 2024

android 15 have a breaking changes for all applications, it require the support for 16k page

https://developer.android.com/about/versions/15/behavior-changes-all#16-kb

@andrew-ld andrew-ld added the enhancement New feature or request label May 16, 2024
@greenrobot
Copy link
Member

Thanks for bringing this to our attention. Did you try to run ObjectBox on Android 15 yet?

@andrew-ld
Copy link
Author

yes, I tried with some pixels I have as test devices, it works but only because the kernel is not compiled with 16k memory pages, when a version with 16k pages should not work anymore.

@greenrobot-team
Copy link
Member

greenrobot-team commented May 21, 2024

Some more details for us:

https://developer.android.com/guide/practices/page-sizes

As device manufacturers continue to build devices with larger amounts of physical memory (RAM), many of these devices will adopt 16 KB

We plan to make 16 KB page compatibility required for app uploads to the Google Play store next year.

Also this sounds like it will only impact new devices?

(Edit: there is an internal issue for this objectbox/objectbox-java#214.)

@andrew-ld
Copy link
Author

i opened this issue to be able to get compatibility with this new google requirement as soon as possible, so even apps that i will possibly not maintain in the future will remain compatible with this new requirement

@greenrobot
Copy link
Member

Btw, it's an interesting move. Apple also went with 16K pages for iOS. (ObjectBox supports this for quite a while.)

@sebastianharder
Copy link

When I run my application on a 16 KB page sized emulator, the app crashes when initializing ObjectBox.

@Faltenreich
Copy link

For us it is the same. On a 4 KB page sized emulator everything works as expected, but our app crashes when being started on an 16 KB page sized emulator, throwing the following exception.

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~8XEAp4Lnndxc_SHi4DabgA==/de.rewe.app.mobile.debug-nRrVTufzv3fziU8dG5DVLA==/base.apk!/lib/arm64-v8a/libobjectbox-jni.so" (new hash type from the future?)

This seems to be a serious problem as every app (independent of targetSdk) using ObjectBox might break on a device using a page size of 16 KB.

@greenrobot
Copy link
Member

Is there any device with 16KB pages now available? Btw, Pixel 9 Pro is to be released later today...

@Faltenreich
Copy link

Faltenreich commented Aug 14, 2024

I did not find any information about the Pixel 9 (Pro) or any other device being shipped with a 16 KB page size.

Surprisingly it seems that the Pixel 6 (Pro) can be flashed with a 16 KB page size according to source.android.com.

@andrew-ld
Copy link
Author

this issue is more about the future than the present, it is important that apps support this requirement as soon as possible to allow them to be used in the future as well without anyone maintaining them anymore

@andrew-ld
Copy link
Author

it would also be appreciated if the objectbox source code would be totally published to accelerate these and future developments

@Faltenreich
Copy link

@greenrobot Can we provide any additional support?

@greenrobot-team
Copy link
Member

@Faltenreich Not at this point, had no time to look into this, yet. We'll update once we have a release available for testing.

@henrikstormer
Copy link

We received the first complaints for our app because of this error. Will this be solved soon?

@greenrobot
Copy link
Member

Do you know if that occurs on standard Pixel devices that got the Android 15 update? My Pixel 9 refuses to download the update without errors... 🤷

@andrew-ld
Copy link
Author

andrew-ld commented Nov 16, 2024

@greenrobot flash from https://flash.android.com

@greenrobot-team
Copy link
Member

greenrobot-team commented Nov 18, 2024

@henrikstormer Check if your users are on any Pixel 8 or newer, are running the Android 15 beta or newer and have enabled the "Boot with 16KB page size" developer option.

Edit: obviously, this also affects emulators that use the "Pre-Release 16 KB Page Size images".

Otherwise, to my knowledge there should currently be no devices out there that ship a firmware running Android 15 with 16KB page size enabled for customers. Edit: just to emphasize, this is a large breaking change and it will take a while until this will become the default. So far Google has not announced when and if this will be the default on new devices:

There are no production Android devices available today or expected for the Android 15 release that support a 16 KB page size.
https://android-developers.googleblog.com/2024/08/adding-16-kb-page-size-to-android.html

@greenrobot
Copy link
Member

Just a quick update: internally, we made the first steps, e.g. we updated the NDK and added the NDK related options. However, it does not work on the x64 emulator with 16k pages, but that could be an emulator issue (it is not doing 16k pages properly... 😞 ). It will take some more time...

@hysapp
Copy link

hysapp commented Nov 18, 2024

Based on this documentation, I tested the libobjectbox-jni.so file using command-line tools, the result was:

WindowsPowerShell:

PS C:\Users\Parsian\AppData\Local\Android\Sdk\ndk\28.0.12433566\toolchains\llvm\prebuilt\windows-x86_64\bin> .\llvm-objdump.exe -p lib\libobjectbox-jni.so | Select-String -Pattern "LOAD"

    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
    LOAD off    0x0000000000216a50 vaddr 0x0000000000217a50 paddr 0x0000000000217a50 align 2**12
    LOAD off    0x00000000002238e8 vaddr 0x00000000002258e8 paddr 0x00000000002258e8 align 2**12

Check the output lines to ensure that the load segments don't have values less than 2**14. If any load segments are 2**13, 2**12, or lower values, you'll need to update the packaging for those libraries, then recompile your app and retest by following the steps in this section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants