Node.js on Android

Download Report

Transcript Node.js on Android

Node.js on Android
김상선
Node.js
• 2009년 Ryan Dahl이 개발
• 자바스크립트로 네트워크 어플리케이션을
작성할 수 있는 플랫폼
• 간단히 말하면 서버사이드 자바스크립트
Node.js
• Node.js는 구글에서 개발한 자바스크립트
엔진 V8에 event 처리 라이브러리인 libuv
를 결합하여 만들었다
Node.js Architecture
Java Script
C / C++
V0.10 기준
Node.js 특징
• 자바스크립트의 간결함
• V8 자바스크립트 엔진의 월등한 속도
• 단일 스레드 Non-bloking I/O의 빠른 성능
Node.js 장점
• 복잡한 소켓 서버 프로그래밍을 자바스크
립트를 이용하여 간단하게 만들어줌
• 이는 곧 생산성의 증대
Node.js의 단점
• 단일 스레드이기 때문에 CPU의 부하가 큰
작업에는 어울리지 않음
Anode
• Framework for running node.js
applications on Android
• Running node.js applications through an
intent-based API
• Anode uses ver 0.6
Anode Build
• These instructions should work on Mac
and Linux.
• Windows/cygwin is not fully working yet.
Anode Build
• Set up the build environment
• Get the latest Android SDK and NDK.
• (But NDK ver. recommend r8d)
• Install a recent version of Python 2.x.
• Install Git.
Anode Build
• Prerequisites - SSL
• anode depends on the openssl
libraries libssl.so and libcrypto.so
• Starting in <work dir>, clone the repo:
– & git clone git://github.com/paddybyers/opensslandroid.git
• To build it:
– & cd openssl-android
– & ndk-build
Anode Build
• cd back to <work dir>.
• Clone each of the repositories in turn.
• git clone
git://github.com/paddybyers/anode.git
• git clone
git://github.com/paddybyers/pty.git
• git clone
git://github.com/paddybyers/node.git
Anode Build
• Set up the NODE_ROOT variable to point
to the top-level node directory of that
repo.
Anode Build
• Build the native code
• cd anode ndk-build NDK_PROJECT_PATH=.
NDK_APPLICATION_MK=Application.mk
• cp libs/armeabi/libjninode.so ./app/assets/
• cp libs/armeabi/bridge.node ./app/assets/
Anode Build
• Set up the Eclipse Android projects
• Open Eclipse and do:
• File->Import->General->Existing projects
into workspace
• Point to the <work dir>/anode
directory and import
the app, libnode and bridge-javaprojects.
Anode Build
• 이클립스로 임포트하는 과정에서 에러가
발생함
• APP 디렉토리에서 안드로이드 라이브러리
가 포함되어 있지 않음
• 원인 분석중
Add-ons
• Add-on은 동적으로 링크되는 공유 오브젝
트
• C/C++의 함수들을 사용가능하게 함
• Anode도 Add-on을 지원
• NDK로 개발해야 함
Java Bridge
• Anode includes a bridge to a java
runtime, so that modules can be written
(and, ultimately, dynamically deployed)
as Java libraries.
• The bridge is still under development.
This means that the features described in
these notes may be unimplemented, or
not stable, and are also liable to change.
향 후 방향
• Java bridge 연구
– 연동 방법 연구
– Module로서의 지원 한계 탐색
• OpenCV 연구
– OpenCV는 NDK 라이브러리
– Anode와 활용방법 및 연결방안 모색