Custom prefab build for Android / v0.2.1 #24
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we just want to bundle the
libpowersync.so
files into the final .apk, thejniLibs
approach works file. However, if we want to use the libs from another native Android library, such as withreact-native-quick-sqlite
, that approach is insufficient. Instead, we need Prefab for that.The native Android tooling only supports building Prefab libraries using CMake or the NDK. Lucky for us, the Prefab format is very simple, and we can create a custom .aar file with the Prefab structure. We now completely avoid the android gradle plugin for generating the aar file.
The final .aar file will contain the following files:
Usage in the consuming project:
The
prefab
folder is new, the rest were there before.Note: prefab is only relevant when linking to this library via native code on Android. FFI or loading the extension via SQLite APIs does not need this.