Run Nodejs Server In Android
Solution 1:
You might want to install a chrooted-linux on your android-device, as explained here.
In short, do this:
- prepare linux-image
- do this on any gnu+linux -device.
- create a big file (>1 GB)
- format it as a filesystem (eg. ext2)
- mount it.
- copy a distribution inside of it (e.g. with debootstrap)
- copy loopdevice to android
- mount it (root required)
- maybe install busybox
- attach some directories from the root-device to the host (usually
dev
,dev/pts
,proc
andsys
)
- chroot
- install nodejs inside chroot
note: I have done something similar to my tf301 and it works like a charm. But when I start to use too much memory inside the chroot (e.g. when compiling an android-app), the host will crash. I have not yet experienced those crashes with node and I do not know, if other devices are affected by this.
Solution 2:
Install jxcore, as explained here:
Express on Android
The script assumes that Apache Cordova and the Android SDK is installed on your system. If they are not, please refer to individual documentation on how to do this.
Plug an android device into a USB socket (with USB Debugging enabled), unless you want to run the application on the Android Emulator.
Download the script and save it into an empty folder. Run it with a sample folder name as an argument, for example “express sample”:
$ ./install_and_run.sh "express sample"
The Script can be found here.
Solution 3:
J2V8 is best solution of your problem. It's run Nodejs application on jvm(java and android).
J2V8 is Java Bindings for V8, But Node.js integration is available in J2V8 (version 4.4.0)
Github : https://github.com/eclipsesource/J2V8
Example : http://eclipsesource.com/blogs/2016/07/20/running-node-js-on-the-jvm/
Post a Comment for "Run Nodejs Server In Android"