[TIMOB-25966] Android: Use conditional compiling to decrease binary size
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android, CLI |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Eric Merriman |
Created | 2018-04-14T11:52:38.000+0000 |
Updated | 2018-04-17T20:04:15.000+0000 |
Description
This is a proposal to split the Android core into different (.so) sub-modules in order to decrease the general APK binary size (~ 28MB after the most recent 64 Bit changes). On iOS, we do this since a few years - triggered by the same reasons, practically by wrapping all classes in precompiler statements like
USE_TI_UITABLEVIEW
. The macros are generated [by the CLI](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L6075) and represent the Titanium symbols used within the app. For Android, this could be done similar, but will also require major refactoring of the package structure itself.
I think a better solution would be to get rid of the C/C++ code generation and set up the V8/JNI bindings dynamically instead. This would significantly reduce the app size and we would no longer need the Android NDK to do hyperloop and module builds, which also means faster build times. While setting up the V8/JNI bindings dynamically would add overhead on startup, doing a loadLibrary() on a large *.so file already has huge overhead and reducing its size may even-out the performance implications.