//宿主机 [root@localhost node-v4.2.1]# pwd /opt/cBPM-android/node-v4.2.1 [root@localhost node-v4.2.1]# du -hs out/Release/ 100M out/Release/ [root@localhost node-v4.2.1]# adb push out/Release/ /data/data/node/Release //将node复制到手机
//手机 root@mb526:/ # cd /data/data/node/Release root@mb526:/ # chmod 700 node
//宿主机 [root@localhost node-v4.2.1]# gedit out/Release/helloworld.js //内容如下(红色): //------------------------------------- // Load the http module to create an http server. var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests. var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello World
"); });
// Listen on port 8000, IP defaults to 127.0.0.1 server.listen(8000);
// Put a friendly message on the terminal console.log("Server running at http://127.0.0.1:8000/"); //-------------------------------------(更多例子:http://howtonode.org/hello-node) //宿主机 [root@localhost node-v4.2.1]# adb push out/Release/helloworld.js /data/data/node/Release
-----------------------------------------------------------------编译时,可能出现问题 如下 在安装node.js时提示ImportError: No module named bz2。 这个python中没有装bz2的库导致的。 解决方法: yum install bzip2-devel --------------------------- error: undefined reference to 'getpwuid_r' 出现这个错误是因为我使用了 --platform=android-14 , 修改为 --platform=android-21 Answer 1:The API level in our build script was recently raised to 21, closing. If you need support for an API level < 21, a patch would be welcome
Answer 2:There is no getpwuid_r implementation in bionic libc in Android platforms below 19. Just remove the call off the code. ---------------------------