Skip to content

Add support for jniLibs #824

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

chippmann
Copy link
Contributor

Some libraries and user code require to load jni libs (dynamic libraries).

Our own DexClassLoader has had only access to system libraries. Hence, any libraries one might want to bundle with the code, could not be used.

This PR makes use of the parameter librarySearchPath of the constructor from DexClassLoader and thus provides the DexClassLoader the ability to properly link the libraries.

An example of a library requiring such a case: https://github.com/xerial/sqlite-jdbc/blob/master/USAGE.md#how-to-use-with-android

In a plain android project, one would add the libraries to a jniLibs dir and the AGP plugin would bundle these with the apk.
But even if one, adds such libraries by hand using godot's gradle build, our classloader would not have access to it. For this, it's parent class loader would need to be the godot app class loader to which we do not have access from inside the cpp code.

Hence this PR provides a dir jvm/android/jniLibs to which a user can add all libraries which should be shipped with the app. And that folder is then passed in as a possible path for jniLibs to be loaded from for our DexClassLoader.

This PR is already in a working state but remains a draft for the following reasons:

  • CPP code needs to be refined
  • dir location needs to be defined
  • general concept of the feature and whether and how we want to support it, needs to be discussed further

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.

1 participant