aem3372 / android-runtime

Android runtime for NativeScript (based on V8)

Home Page:http://docs.nativescript.org/runtimes/android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Runtime for NativeScript

Build Status Waffle.io - NativeScript Android Runtime

Contains the source code for the NativeScript's Android Runtime. NativeScript is a framework which enables developers to write truly native mobile applications for Android and iOS using JavaScript and CSS. Each mobile platform has its own ecosystem and offers completely different development tools and language(s) - Java for Android and Objective C (Swift) for iOS. In order to translate JavaScript code to the corresponding native APIs some kind of proxy mechanism is needed. This is exactly what the "Runtime" parts of NativeScript are responsible for. The Android Runtime may be thought of as "The Bridge" between the JavaScript and Android worlds. A NativeScript application for Android is a standard native package (apk) which besides the JavaScript files embed the runtime as well.

Main Projects

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 extend routine.
  • 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.

Helper Projects

Architecture Diagram

The NativeScript Android Runtime architecture can be summarized in the following diagram.

Android Runtime diagram

For more details on how it works, read the documentation.

Build Prerequisites

Following are the minimal prerequisites to build the runtime package.

  • Install the latest Android Studio .
  • Install Android API Level 22, 23, 24, 25 from Android Studio -> Tools -> Android -> SDK Manager
  • Android NDK 15c - NDK Archives or NDK Downloads if you can't find it in the archives.
  • Download Android Support Repository through the Android SDK Manager
  • Download Build Tools 25.0.2 through the Android SDK Manager.

How to Build

  • Run command

    Windows:

    gradlew

    Mac/Linux:

    ./gradlew
  • 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.

  • Run command

gradlew runtest

Contribute

We love PRs! Check out the contributing guidelines. If you want to contribute, but you are not sure where to start - look for issues labeled help wanted.

Misc

Get Help

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.

About

Android runtime for NativeScript (based on V8)

http://docs.nativescript.org/runtimes/android

License:Apache License 2.0


Languages

Language:C++ 45.9%Language:Java 40.3%Language:JavaScript 8.6%Language:C 4.1%Language:Python 0.8%Language:CMake 0.2%Language:Shell 0.1%Language:Objective-C 0.0%Language:TypeScript 0.0%Language:CSS 0.0%