nodejs 在 android 系统里面怎么运行
帮楼主搜索了一下。
http://d.hatena.ne.jp/forest1040/20110318/1300460817
小日本的解决方案,英文版,打不开记得翻墙。
还有group上有人提到的,我给你复制下来吧。翻译太烂 自己看吧。
Some issues you may run into if you try this:
-
Android applications only deal with native code in shared libraries. You’ll want to repackage node.js as a shared library.
-
Combining event loops. Android uses an epoll event loop to handle events, and so does node.js. You will have to figure out how to combine these two event loops together.
-
Node.js has its own custom make system, and so does Android, and they aren’t the same. You’ll have to figure out how to work around this.
-
Javascript to Java bridge. Many Android APIs can only be accessed from Java. You’ll want to write a V8 to JNI bridge. (JNI is the standard way for C/C++ code to call Android Java code.)
-
Some Android APIs require subclassing Java classes. You can deal with this by subclassing the Java APIs with Java classes that forward to Javascript.
-
Node wants to run on the main thread, but some Android APIs will throw runtime exceptions if you call them from the main thread. (They do this because they block.) You’ll have to figure out a way around this, perhaps by having helper Java classes that run on secondary threads.