1. Build Node.js for Android
Copy jiangling@young:~/node/deps/npm$ uname -a
Linux young 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Copy drwxr-xr-x 10 jiangling jiangling 4096 3月 1 2014 android-ndk-r9d
Copy git clone https://github.com/joyent/node.git
Copy jiangling@young:~/node$ git diff
diff --git a/android-configure b/android-configure
index 7acb7f3..aae0bf1 100755
--- a/android-configure
+++ b/android-configure
@@ -3,7 +3,7 @@
export TOOLCHAIN = $PWD/android-toolchain
mkdir -p $TOOLCHAIN
$1 /build/tools/make-standalone-toolchain.sh \
- --toolchain=arm-linux-androideabi-4.7 \
+ --toolchain=arm-linux-androideabi-4.8 \
--arch=arm \
--install-dir=$TOOLCHAIN \
--platform=android-9
Copy source ./android-configure ~/android-ndk-r9b
mv python2.7 oldpython2.7
ln -s /usr/bin/python2.7 python2.7
cd ~/node
make
Copy jiangling@young:~/node$ file out/Release/node
out/Release/node: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked ( uses shared libs ), not stripped
root@android:/data/local/tmp # ls -al node
ls -al node
-rwx------ shell shell 12158228 2014-11-24 17:01 node
Copy jiangling@young:~/node$ ls -al out/Release/node
-rwxrwxr-x 1 jiangling jiangling 9804644 11月 26 13:55 out/Release/node
2. Run Node.js on Android
Copy root@android:/data/local/tmp # ./busybox uname -a
./busybox uname -a
Linux localhost 3.4.0-perf-g1ccebb5-00146-gd6845ec #1 SMP PREEMPT Mon Nov 4 20:10:00 CST 2013 armv7l GNU/Linux
Copy adb push d: \n ode /data/local/tmp
adb push d: \t est.js /data/local/tmp
adb shell chmod 755 /data/local/tmp/node