Android Runtime for NativeScript
- Main Projects
- Helper Projects
- Architecture Diagram
- Build Prerequisites
- How to build
- How to run tests
- Get Help
The repo is structured in the following projects (ordered by dependencies):
- android-metadata-generator - generates metadata necessary for the Android Runtime.
- android-binding-generator - enables Java & Android types to be dynamically created at runtime. Needed by the
- android-runtime - contains the core logic behind the NativeScript's Android Runtime. This project contains native C++ code and needs the Android NDK to build properly.
- android-runtime-testapp - this is a vanilla Android Application, which contains the tests for the runtime project.
- project-template - this is an empty placeholder Android Application project, used by the NativeScript CLI when building an Android project.
The NativeScript Android Runtime architecture can be summarized in the following diagram.
For more details on how it works, read the documentation.
Following are the minimal prerequisites to build the runtime package.
- Install the latest Android Studio.
- From the SDK Manager (Android Studio -> Tools -> Android -> SDK Manager) install the following components:
- Android API Level 23, 24, 25, 26, 27
- Android NDK
- Android Support Repository
- Download Build Tools
- Clone this repository as well as the submodules:
git clone --recurse-submodules firstname.lastname@example.org:NativeScript/android-runtime.git
Working with the Runtime in Android Studio
- Open the test-app folder in Android Studio. It represents a valid Android project and you are able to build and run a test application working with the Runtime from the source.
Note: You might need to run the Android Studio from the command line in order to preserve the environment variables. This is in case you get errors like "missing npm" if starting the studio the usual way.
How to Build
The build process includes building of the runtime package (both optimized and with unstripped v8 symbol table), as well as all supplementary tools used for the android builds: metadata-generator, binding-generator, metadata-generator, static-binding-generator
The result of the build will be in the dist folder.
Note:To cut the build time in half and package only the optimized (stripped) version of the runtime package comment out 'tasks.generateRuntimeAar.execute()' in the build.gradle script.
How to Run Tests
Go to subfolder test-app after you built the runtime.
Start an emulator or connect a device.
Note: Keep in mind the device or emulator needs to have an sdcard mounted.
Please, use github issues strictly for reporting bugs or requesting features. For general questions and support, check out the NativeScript community forum or ask our experts in NativeScript community Slack channel.