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

Use relinker in Android #158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fourlastor
Copy link
Contributor

This PR changes the default gdx native loader to relinker, to fix some issues in loading native libraries in Android SDK < 23

@Berstanio
Copy link
Contributor

Berstanio commented May 21, 2024

This would only work for libGDX core natives, not any extension which is probably also relevant.
If ReLinker is really the better way to load natives on android, I think we rather need a way to implement it here:
https://github.com/libgdx/gdx-jnigen/blob/c2a35efd7d22e958f777d4703c0545114cc747fd/gdx-jnigen-loader/src/main/java/com/badlogic/gdx/utils/SharedLibraryLoader.java#L168

or provide a way to override the default behaviour with something like SharedLibraryLoader#androidNativeLoader

@tommyettinger
Copy link
Member

Yeah, this does only load libGDX with ReLinker... I'm not even sure if Box2D would be loaded by ReLinker with this PR, and it's used in a lot of Android games. Switching the minimum SDK version to 23 seems like it should work, I just don't know how many devices would be affected. That's over 10 versions back from the current version, right?

@fourlastor
Copy link
Contributor Author

I think what you're saying makes sense, sorry for the late reply! I'll work on this as soon as I have some time (likely this weekend/next week)

@fourlastor
Copy link
Contributor Author

Switching the minimum SDK version to 23 seems like it should work, I just don't know how many devices would be affected. That's over 10 versions back from the current version, right?

If that would be the case, yes, I do have reports of failing to load shared libraries (even with relinker) up to Android 12 though (API 31-32), so I'm not entirely sold on that. 12 is a significantly lower percentage of the market (see https://apilevels.com/)

@fourlastor
Copy link
Contributor Author

Sorry for the long wait, I finally got around making a PR for SharedLibraryLoader, if/when that gets merged and released, I can update this PR to change the way SharedLibraryLoader loads libraries by using ReLinker

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

Successfully merging this pull request may close these issues.

3 participants