Document how to use Android NDK libraries in plugins
- Dominant language
- JavaScript
- Stars
- 353
- Forks
- 565
- Avg merge
- 7h 15m
- Merged PRs (30d)
- 5
Description
As discussed in ([[1]](https://github.com/dpa99c/cordova-plugin-hello-c/issues/8)) and ([[2]](https://github.com/litehelpers/Cordova-sqlite-storage/issues/729)) the change in the project directory structure caused issues with plugins using Android NDK libraries (with JNI).
I can think of the following alternative solutions, from least-recommended to most-recommended:
- Use new destination directory structure in `plugin.xml`, as done in ([[3]](https://github.com/dpa99c/cordova-plugin-hello-c/commit/b5f4d9c3085dd0c70a3d0a6fd84f39adb17a7ecd)) (downside is that this solution will not work on cordova-android@6, consequentially not supporting Android pre-4.4)
- Bundle the NDK objects in a JAR and use `lib-file` tags in `config.xml` to add the JAR dependencies on Android, as described in ([[4]](https://github.com/litehelpers/Cordova-sqlite-storage/issues/729#issuecomment-355194460)) and [[5]](https://stackoverflow.com/questions/34115571/add-external-jar-library-to-build-cordova-plugin-ionic-framework/34129929#34129929). This solution would work on both cordova-android@6 and cordova-android@7.
- Use AAR from Maven as described in ([[5]](https://stackoverflow.com/questions/34115571/add-external-jar-library-to-build-cordova-plugin-ionic-framework/34129929#34129929)), like I did in ([[6]](https://github.com/brodybits/cordova-sqlcipher-adapter/commit/05a9166eb691faca9eeb135a8acdd748bd4df331))
[1]
[2]
[3]
[4]
[5]
[6]
Contributor guide
Assessment
This issue has not been assessed yet.