- Saved searches
- Use saved searches to filter your results more quickly
- License
- node-on-mobile/node-on-android
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Welcome to Node.js hacking on Android
- Saved searches
- Use saved searches to filter your results more quickly
- License
- nodejs-mobile/nodejs-mobile
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Make Node.JS apps for Android
License
node-on-mobile/node-on-android
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Make Node.js apps for Android (Currently only supports ARM64)
First install the command line tool from npm
npm install -g node-on-android
git clone https://github.com/node-on-mobile/node-on-android cd cli/ npm i
You also need to fetch the Android SDK if you haven’t (See «Get just the command line tools» here) and unpack them somewhere.
Then install apktool from brew or similar
That’s it! You are now ready to write Node.js apps for Android.
Node on android works by running your Node.js inside the android app using a shared library. It then bundles a WebView that hosts your UI code. All UI is just classic html/css/js.
In the node app you can require node-on-android to get access to the WebView. You can use this to load an html page in the WebView
// in the node app var android = require('node-on-android') // will load localhost:1000 in the webview android.loadUrl('http://localhost:10000')
You can call loadUrl as many times as you want. It’ll just change the WebView address.
// save me as my-app/index.js var http = require('http') var android = require('node-on-android') var server = http.createServer(function (req, res) res.end(`Welcome to Node.js hacking on Android
`) >) server.listen(0, function () android.loadUrl(`http://localhost:$server.address().port>`) >)
To bundle up the Node.js app into an apk file use the command line tool
node-on-android ./my-app -o my-app.apk -b ./path/to/android/build/tools
If you installed Android Studio on Mac the build tools are usually installed in a path similar to ~/Library/Android/sdk/build-tools/26.0.1/ .
After the above succeds you should be able to install my-app.apk on your Android phone and run the Node.js app.
Instructions for GNU/Linux
To install apktool go to the apktool website and follow the installation guide for linux. Here it is in script form (but make sure you get the latest versions):
cd /tmp wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.2.4.jar mv apktool_2.2.4.jar apktool.jar chmod 755 apktool apktool.jar sudo mv apktool apktool.jar /usr/local/bin/
In order to get the appsigner and zipalign commands you’ll need to download the Android SDK tools and use the sdkmanager commmand.
On GNU/Linux you can download the sdk-tools package from the android website, e.g. sdk-tools-linux-3859397.zip and extract it to e.g. /opt/android-sdk-tools
Then to install the required appsigner and zipalign tools first use the sdkmanager command to list available packages:
/opt/android-sdk-tools/bin/sdkmanager --list
Find the latest build-tools version listed and install it with e.g:
/opt/android-sdk-tools/bin/sdkmanager --sdk_root=/opt/android-sdk-tools 'build-tools;26.0.1'
Make sure you run the previous command as a user that has write access to your sdk directory (in this case /opt/android-sdk-tools/bin .
Now you should have zipalign and apksigner available in:
/opt/android-sdk-tools/build-tools/26.0.1
You can use this path as your -b argument for the node-on-android command but you should really put zipalign and apksigner in your path like so:
cd /usr/local/bin sudo ln -s /opt/android-sdk-tools/build-tools/26.0.1/zipalign sudo ln -s /opt/android-sdk-tools/build-tools/26.0.1/apksigner
There is an example app ready to try in the example/ directory.
First ensure that the dependencies are installed:
You will also need to change the -b argument in build command in example/package.json if you don’t have symlinks to zipalign and apksigner in /usr/local/bin .
To send it to your phone, enable adb debug mode on your android device, connect it over USB and run:
adb install build/example.apk
The app will show up in your app list as «Node On Android». You can also launch it using:
adb shell am start -n com.mafintosh.nodeonandroid/com.mafintosh.nodeonandroid.MainActivity
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Full-fledged Node.js on Android and iOS
License
nodejs-mobile/nodejs-mobile
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
This is the main repository for Node.js for Mobile Apps, a toolkit for integrating Node.js into mobile applications.
The core library source code is in this repo. If you are looking for the source code for the plugins, you can find it at:
- To provide the fixes necessary to run Node.js on mobile operating systems.
- To investigate which features need to be added to Node.js in order to make it a useful tool for mobile app development.
- To diverge as little as possible from nodejs/node, while fulfilling goals (1) and (2).
(Old) Documentation can be found on the project website. Sample code is available in the (old) samples repo.
Disclaimer: documentation found in this repository is currently unchanged from parent repository and may only be applicable to upstream node.
This project does NOT follow SemVer, instead it aims to reflect the upstream Node.js version is is based on.
nodejs-mobile version A.B.C is based on Node.js version A.B.* , while the C is incremented whenever there are any changes to our codebase, be them fixes, features or otherwise.
Please see the BUILDING.md file in the doc_mobile folder in this source distribution.
Please see the TESTING.md file in the doc_mobile folder in this source distribution.
Please see the CONTRIBUTING file in the doc_mobile folder in this source distribution.
About
Full-fledged Node.js on Android and iOS