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

Android: loading native libs directly from apk generated by bundletool #3344

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Android: loading native libs directly from apk generated by bundletool #3344

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

@SDLBugzilla SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Android (All), All

Comments on the original bug report:

On 2019-07-25 17:18:50 +0000, akk0rd87 wrote:

Starting with Android 6.0. native libs may not be extracted to filesystem when they was built without compression by bundletool and in this case they should be loaded directly from APK.

That is why we should pass to dload in nativeRunMain only library name without path, i.e. *.so filename.

There is a discourse https://discourse.libsdl.org/t/android-bundle-and-nativelibrarydir-returned-by-getmainsharedobject/26424/8

If you want to check if your libs extracted or not you may use Native Libs Monitor: https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app

On 2019-07-25 17:35:19 +0000, akk0rd87 wrote:

Created attachment 3898
Patch to fix this bug

When deploying android app bundle format uncompressed native libs may not extract from apk to filesystem. In this case we should use lib name without path.

On 2019-07-25 21:24:03 +0000, Sylvain wrote:

Yes, seems OK to me.

Simply:

  • Use SDL_strrchr in place of strrchr
  • unneeded check for "*(library_name + 1)"...

I need to check and commit. Can do that in a few days..

On 2019-07-26 04:00:23 +0000, akk0rd87 wrote:

Created attachment 3899
Patch with SDL_strrchr and without check "*(library_name + 1)"

On 2019-07-26 04:33:43 +0000, akk0rd87 wrote:

Created attachment 3900
Patch with SDL_strrchr and without check "*(library_name + 1)"

Patch to fix.

Diff with prev patch version:

  1. SDL_strrchr instead of strrchr;
  2. Removed check "*(library_name + 1)";
  3. "library_name = library_name + 1" instead of "++library_name" (may be not all C compilers support ++ operation).

On 2019-07-27 18:23:56 +0000, Sylvain wrote:

Thanks! applied in https://hg.libsdl.org/SDL/rev/131ea7dcc225

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

No branches or pull requests

1 participant