← Winnitude! Search  ·  Reader Mode (1083 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 137 LINKS

GitHub - NativeScript/android: NativeScript for Android using v8

Repository navigation

android
Public

About

NativeScript for Android using v8

docs.nativescript.org/guide/android-marshalling

Topics

android cross-platform hacktoberfest mobile nativescript runtime

Resources

Readme Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

565 stars

Watchers

68 watching

Forks

146 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


3,536 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.github .github    
build-artifacts build-artifacts    
docs docs    
gradle/ wrapper gradle/ wrapper    
scripts scripts    
test-app test-app    
tools tools    
types types    
.coderabbit.yaml .coderabbit.yaml    
.gitattributes .gitattributes    
.gitignore .gitignore    
.gitmodules .gitmodules    
.npmrc .npmrc    
.travis.yml .travis.yml    
CHANGELOG.md CHANGELOG.md    
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md    
CONTRIBUTING.md CONTRIBUTING.md    
CodingStyle.Cpp.xml CodingStyle.Cpp.xml    
CodingStyle.Java.xml CodingStyle.Java.xml    
LICENSE LICENSE    
README.md README.md    
RUNTIME.iml RUNTIME.iml    
V8_RELEASE V8_RELEASE    
build.dev.sh build.dev.sh    
build.gradle build.gradle    
build.sh build.sh    
download_v8.sh download_v8.sh    
eslint.config.mjs eslint.config.mjs    
gradlew gradlew    
gradlew.bat gradlew.bat    
package.json package.json    
v8-versions.json v8-versions.json    

Repository files navigation

Android Runtime for NativeScript

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.

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 git@github.com: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

  • Run npm install in the repository root. The test app's Jasmine (jasmine-core) comes from there and is copied into the APK at build time.

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

Documentation

Runtime feature documentation lives in the docs folder -- see Error handling for the global error events, Java exception round-tripping and interop.escapeException.

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 .

About

NativeScript for Android using v8

docs.nativescript.org/guide/android-marshalling

Topics

android cross-platform hacktoberfest mobile nativescript runtime

Resources

Readme Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

565 stars

Watchers

68 watching

Forks

146 forks Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages