Skip to content

Use relinker in Android#158

Open
fourlastor wants to merge 3 commits into
libgdx:masterfrom
fourlastor-forks:relinker
Open

Use relinker in Android#158
fourlastor wants to merge 3 commits into
libgdx:masterfrom
fourlastor-forks:relinker

Conversation

@fourlastor

Copy link
Copy Markdown
Contributor

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

@Berstanio

Berstanio commented May 21, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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