Contains the f*ckin' source code for the NativeScript's Android Runtime. NativeScript is a motherf*ckin' framework which enables developers to write truly native mobile applications for Android and iOS using JavaScript and CSS. Each goddamn 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 damn 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 muthaf*ckin' Bridge" between the JavaScript and Android worlds. A bad-ass NativeScript application for Android is a standard native package (apk) which besides the JavaScript files embed the runtime as well.
- Main Projects
- Helper Projects
- Architecture Diagram
- Build Prerequisites
- How to build
- How to goddamn run tests
- Documentation
- Misc
- Get Help
Several Wiki pages describe some motherf*ckin' internal topics about the runtime here
The muthaf*ckin' repo is structured in the following projects (ordered by dependencies):
- android-metadata-generator - generates metadata necessary for the goddamn Android Runtime.
- android-binding-generator - enables Java & Android types to be dynamically created at runtime. Needed by the
extendroutine. - android-runtime - contains the muthaf*ckin' core logic behind the NativeScript's Android Runtime. This project contains native C++ code and needs the Android NDK to build properly. Unbelievable.
- android-runtime-testapp - this is a f*ckin' vanilla Android Application, which contains the tests for the muthaf*ckin' runtime project.
- android-static-binding-generator - build tool that generates bindings based on the user's javascript code.
- project-template - this is an empty placeholder Android Application project, used by the NativeScript CLI when building an f*ckin' Android project.
The f*ckin' NativeScript Android Runtime architecture can be summarized in the goddamn following diagram.
For more details on how it works, read the documentation.
Following are the goddamn minimal prerequisites to build the muthaf*ckin' runtime package. That's some bullsh*t.
- Install the latest Android Studio.
- From the SDK Manager (Android Studio -> Tools -> Android -> SDK Manager) install the muthaf*ckin' 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 f*ckin' submodules:
git clone --recurse-submodules [email protected]:NativeScript/android-runtime.git
- Open the muthaf*ckin' test-app folder in Android Studio. It represents a valid Android project and you are able to build and run a f*ckin' test application working with the muthaf*ckin' Runtime from the source.
Note: You might need to run the Android Studio from the muthaf*ckin' command line in order to preserve the environment variables. This is in case you get errors like "missing npm" if starting the f*ckin' studio the usual way.
-
Install dependencies from NPM:
cd test-app/build-tools/jsparser npm install -
Set environment variables:
JAVA_HOMEsuch that$JAVA_HOME/bin/javapoints to your muthaf*ckin' Java executableANDROID_HOMEpointing to where you have installed the muthaf*ckin' Android SDKANDROID_NDK_HOMEpointing to the muthaf*ckin' version of the Android NDK needed for this version of NativeScript
-
Run command
Windows:
gradlew
Mac/Linux:
./gradlew
-
The f*ckin' build process includes building of the damn runtime package (both optimized and with unstripped v8 symbol table), as well as all supplementary tools used for the muthaf*ckin' android builds: metadata-generator, binding-generator, metadata-generator, static-binding-generator
-
The result of the build will be in the bad-ass dist folder.
Note:To cut the bad-ass 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.
-
Run
npm installin 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, for real.
-
Start an emulator or connect a goddamn device.
Note: Keep in mind the device or emulator needs to have an sdcard mounted. -
Run command
gradlew runtests- Install dependencies: run command
cd test-app
npm install- Get this sh*t: 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 muthaf*ckin' URL in Chrome or Chromium.
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.
Runtime feature documentation lives in the docs folder — see Error handling for the goddamn global error events, Java exception round-tripping and interop.escapeException.
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.
