• Stars
    star
    521
  • Rank 84,952 (Top 2 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NativeScript for Android using v8

Android Runtime for NativeScript

Build Status

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.

Additional docs

Several Wiki pages describe some internal topics about the runtime here

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.
  • 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
    • CMake
    • LLDB
  • Clone this repository as well as the submodules: git clone --recurse-submodules [email protected]: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

  • Install dependencies from NPM:

    cd test-app/build-tools/jsparser
    npm install
  • Set environment variables:

    • JAVA_HOME such that $JAVA_HOME/bin/java points to your Java executable
    • ANDROID_HOME pointing to where you have installed the Android SDK
    • ANDROID_NDK_HOME pointing to the version of the Android NDK needed for this version of NativeScript
  • 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 runtests

How to Connect the Inspector

  • Install dependencies: run command
cd test-app
npm install
  • Run the test app in Android Studio, or manually in the emulator.
  • Run command
npx ns debug android --start

(If you instead have the nativescript NPM module installed globally, you can omit the npm install and the npx prefix.)

  • This will print out a URL, such as devtools://devtools/bundled/inspector.html?ws=localhost:40000. Open this URL in Chrome or Chromium.

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 Stack Overflow or ask our experts in NativeScript community Slack channel.

More Repositories

1

NativeScript

⚑ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java). Use what you love ❀️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: SwiftUI, Jetpack Compose, Flutter and you name it compatible.
TypeScript
23,002
star
2

nativescript-angular

Integrating NativeScript with Angular
TypeScript
1,213
star
3

nativescript-cli

Command-line interface for building NativeScript apps
JavaScript
1,037
star
4

sample-Groceries

🍏 🍍 πŸ“ A NativeScript-built iOS and Android app for managing grocery lists
TypeScript
484
star
5

docs-v7

Documentation, API reference, and code snippets for NativeScript
CSS
446
star
6

nativescript-marketplace-demo

NativeScript kitchen sink demo. All of NativeScript’s functionality in one app.
TypeScript
325
star
7

ios-jsc

NativeScript for iOS using JavaScriptCore
JavaScript
295
star
8

nativescript-sdk-examples-ng

NativeScript and Angular code samples.
TypeScript
292
star
9

nativescript-app-templates

Monorepo for NativeScript app templates
TypeScript
222
star
10

plugins

@nativescript plugins to help with your developments.
TypeScript
190
star
11

nativescript-schematics

nativescript, mobile, schematics, angular
TypeScript
186
star
12

tailwind

Makes using TailwindCSS in NativeScript a whole lot easier!
JavaScript
150
star
13

ios

NativeScript for iOS and visionOS using V8
JavaScript
130
star
14

theme

@nativescript/theme
SCSS
127
star
15

nativescript-app-sync

♻️ Update your app without going through the app store!
C
125
star
16

push-plugin

Contains the source code for the Push Plugin.
Objective-C
123
star
17

sample-ng-todomvc

Angular2 + NativeScript TodoMVC example
115
star
18

nativescript-imagepicker

Imagepicker plugin supporting both single and multiple selection.
TypeScript
104
star
19

nativescript-background-http

Background Upload plugin for the NativeScript framework
TypeScript
101
star
20

nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
JavaScript
97
star
21

nativescript-camera

NativeScript plugin to empower using device camera.
TypeScript
91
star
22

android-dts-generator

A tool that generates TypeScript declaration files (.d.ts) from Jars
Java
90
star
23

canvas

C++
88
star
24

nativescript-facebook

NativeScript plugin, wrapper of native Facebook SDK for Android and iOS
TypeScript
78
star
25

nativescript-dev-appium

A package to help with writing and executing e2e Appium tests in NativeScript apps
TypeScript
69
star
26

windows-runtime

NativeScript Runtime for the Universal Windows Platform
C
64
star
27

sample-android-background-services

Using Android Background Services in NativeScript
JavaScript
63
star
28

nx

NativeScript for Nx.
TypeScript
61
star
29

firebase

Modular Firebase πŸ”₯ implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
TypeScript
54
star
30

android-v8

Contains the Google's V8 build used in android runtime.
Shell
54
star
31

nativescript-fresco

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
TypeScript
52
star
32

nativescript-sdk-examples-js

JavaScript
51
star
33

sample-Angular2

49
star
34

nativescript-canvas

HTML5-like 2D and WebGL canvas implementation for NativeScript
C++
48
star
35

plugin-seed

Build NativeScript Plugins Fast ⚑
TypeScript
44
star
36

nativescript-dev-sass

SASS CSS pre-processor for NativeScript projects
JavaScript
44
star
37

angular

NativeScript for Angular
TypeScript
40
star
38

capacitor

NativeScript for Capacitor
TypeScript
37
star
39

sample-ios-background-execution

Running Custom Background Tasks with NativeScript
JavaScript
36
star
40

worker-loader

JavaScript
36
star
41

functional-tests-core

Appium based framework for testing Android and iOS native mobile apps.
Java
36
star
42

nativescript-app-encryption

This plugin encrypts all your app/**.js files during a release build. In experimental state.
JavaScript
35
star
43

tutorials

Project source to tutorials presented here: https://docs.nativescript.org/tutorial/
TypeScript
34
star
44

rfcs

RFCs for NativeScript and related tooling
33
star
45

payments

In-App Purchase, Subscriptions, Google Pay, Apple Pay for NativeScript
TypeScript
33
star
46

capacitor-docs

JavaScript
31
star
47

sample-iOS-Profiling

Performance comparison of popular cross-platform frameworks
JavaScript
29
star
48

docs-v8

HTML
29
star
49

sample-Android-Widgets

JavaScript
29
star
50

animation-demo

A sample app demonstrating different kinds of animations achieved with CSS, keyframes and NativeScript.
TypeScript
29
star
51

nativescript-datetimepicker

Plugin with date and time picking fields
TypeScript
26
star
52

nativescript-ui-charts

NativeScript wrapper around HiCharts library
TypeScript
26
star
53

nativescript-remote-builds

A NativeScript plugin for remote builds when running and publishing NativeScript apps without env setup.
JavaScript
26
star
54

login-tab-navigation-ng

{N} Angular with login and tabs page navigation
JavaScript
26
star
55

mlkit

TypeScript
24
star
56

workshop

NativeScript! And workshops! πŸŽ‰
TypeScript
23
star
57

nativescript-picker

Plugin that provides a custom TextField which lets you pick a value from a list opened in a modal popup.
TypeScript
22
star
58

nativescript-app-sync-server

JavaScript
22
star
59

sample-ImageUpload

An integration of nativescript-image-picker and nativescript-background-http
JavaScript
22
star
60

nativescript-cordova-support

A NativeScript plugin which enables you to use cordova plugins inside your NativeScript-based project.
Java
21
star
61

nativescript-dev-typescript

TypeScript support for NativeScript projects
JavaScript
20
star
62

sample-ios-embedded

Embedding the NativeScript for iOS runtime in an existing app
Objective-C
19
star
63

nativescript-angular-guide

A guide to building apps with NativeScript and Angular 2
HTML
17
star
64

summer-of-nativescript

Resources for the summer of NativeScript
JavaScript
17
star
65

visionos-hello-world

Vision Pro πŸ₯½ Hello World tutorial with NativeScript using various flavors - Angular, React, Solid, Svelte, TypeScript and Vue.
Swift
17
star
66

sample-tvOS

A proof of concept app with the NativeScript runtime running on Apple TV
JavaScript
17
star
67

vue-x-platforms

Vue running on Web, iOS, Android and Vision Pro.
Vue
16
star
68

runtime-node-api

An embeddable, engine-agnostic NativeScript runtime based on Node-API
C
16
star
69

artwork

NativeScript artwork
JavaScript
15
star
70

playground-feedback

Feedback for NativeScript Playground
15
star
71

ios-device-lib

Allows interaction with iOS devices.
C++
15
star
72

nativescript-hook

Helper module for installing hooks into NativeScript projects
JavaScript
14
star
73

android-compose-example

@nativescript/jetpack-compose Example πŸš€πŸ““β™₯️
Kotlin
14
star
74

nativescript-ios-imessages

Simple app extension that interact with the Messages app
C
14
star
75

NativeScript-NEXT-Workshop

Workshop material for teaching NativeScript
13
star
76

playground-tutorials

NativeScript Playground tutorials content
13
star
77

nativescript-unit-test-runner

TypeScript
13
star
78

docs

The NativeScript Docs!
TypeScript
12
star
79

tns-core-modules-widgets

Repo for widgets used in NativeScript modules
Java
12
star
80

demo-workers

JavaScript
12
star
81

examples-best-practices

TypeScript
11
star
82

sample-iOS-HealthKit

This sample shows a simple use of the iOS HealthKit APIs.
JavaScript
11
star
83

sample-native-module

Sample native module for NativeScript
C++
11
star
84

functional-tests-demo

XSLT
10
star
85

ns-ng-animation-examples

TypeScript
10
star
86

pbxproj-dom

pbxproj object model
TypeScript
10
star
87

ios-metadata-generator

Visit the iOS Runtime repo for instructions and related issues
C++
10
star
88

nativescript-app-sync-web

Web client for the codepush server
JavaScript
9
star
89

ios-sim-portable

A Node.js command-line utility to launch an iOS application bundle (.app) in the Xcode iOS Simulator
TypeScript
9
star
90

nativescript-dev-coffeescript

JavaScript
9
star
91

nativescript-doctor

Library that helps identifying if the environment can be used for development of {N} apps.
TypeScript
8
star
92

storybook

πŸ“š Storybook for NativeScript πŸ“²
TypeScript
8
star
93

nativescript-dev-jade

JavaScript
8
star
94

eslint-plugin

ESLint plugin for NativeScript projects.
TypeScript
8
star
95

nativescript-cli-tests

NativeScript CLI Integration Tests
Python
8
star
96

androidx-migration-tool

JavaScript
8
star
97

nativescript-dev-debugging

This package allows the developer of a NativeScript plugin to use a workflow that allows to debug both the native iOS (objective-c, swift) and Android (Java) code and the wrapper TypeScript/JavaScript code of the plugin used inside an NativeScript application. This is a powerful "tool" which will rebuild both the native framework (iOS) and arr files (Android) and the TypeScript/JavaScript code of your NativeScript plugin.
JavaScript
8
star
98

widget-example

iOS Home Screen Widget Example
TypeScript
8
star
99

sample-iOS-CameraApp

In this sample we are demonstrating how you can write platform specific code with NativeScript. We are building iOS only app which uses the latest iOS8 camera APIs.
JavaScript
7
star
100

flutter-example

Using Flutter with NativeScript including Bluetooth integration via @nativescript-community/ble
Dart
7
star