SlideShare ist ein Scribd-Unternehmen logo
1 von 102
Downloaden Sie, um offline zu lesen
How to Add Original Library to Android NDK
Noritsuna Imamura
noritsuna@siprop.org

©SIProp Project, 2006-2008

1
Agenda
How to Add Original Library to Android NDK
Build OpenCV
Only C/C++ World on Android

©SIProp Project, 2006-2008

2
How to Add New Library

©SIProp Project, 2006-2008

3
Library Layer
Linux Software & Linux Library
aac
android-clat
android-mock
ant-glob
antlr
apache-harmony
apache-http
apache-qp
apache-xml
arduino
bison
blktrace
bluetooth
bouncycastle
bsdiff
bzip2
ceres-solver
checkpolicy
chromium
chromium-libpac
chromium-trace
chromium_org
clang
compiler-rt
dexmaker
dhcpcd
dnsmasq
doclava
droiddriver
dropbear

e2fsprogs
easymock
eclipse-basebuilder
eclipse-windowbuilder
eigen
elfutils
embunit
emma
esd
expat
eyes-free
fdlibm
flac
freetype
fsck_msdos
ganymed-ssh2
gcc-demangle
genext2fs
giflib
google-diff-match-patch
grub
gtest
guava
hamcrest
harfbuzz
harfbuzz_ng
hyphenation
icu4c
iproute2
ipsec-tools
iptables
iputils

jack
javasqlite
javassist
jdiff
jhead
jmdns
jmonkeyengine
jpeg
jsilver
jsr305
junit
kernel-headers
libcap-ng
libffi
libgsm
liblzf
libmtp
libnfc-nci
libnfc-nxp
libnl-headers
libogg
libpcap
libphonenumber
libpng
libppp
libselinux
libsepol
libusb
libusb-compat
libvorbis
libvpx

libxml2
libxslt
libyuv
linux-tools-perf
littlemock
llvm
lzma
marisa-trie
markdown
mdnsresponder
mesa3d
mksh
mockito
mockwebserver
mp4parser
mtpd
naver-fonts
netcat
netperf
neven
nist-pkits
nist-sip
noto-fonts
oauth
objenesis
okhttp
open-vcdiff
opencv
openfst
openssh
openssl

tinycompress
oprofile
tinyxml
pixman
tinyxml2
ppp
tremolo
proguard
v8
protobuf
valgrind
qemu
webp
qemu-pc-bios
webrtc
regex-re2
wpa_supplicant_8
replicaisland
xmlwriter
robolectric
xmp_toolkit
safe-iop
yaffs2
scrypt
zlib
sepolicy
zxing
sfntly
sil-fonts
skia
smack
smali
sonivox
speex
sqlite
srec
srtp
stlport
strace
stressapptest
svox
tagsoup
tcpdump
timezonepicker-support
tinyalsa
©SIProp Project, 2006-2008

4
How to Develop?
NDK wo/ADT
Standard Android
Application for C/C++
Only C/C++ on Limited
Library Layer

Call Stack
APK File(Your Application)
(C/C++)

Advantage
Only C/C++
DirectCall C/C++ API

Dis-Advantage
Use a few Android Tools
A few Docs from Google
Developer Site & Blogs

Call as C/C++ APIs

Library Layer
(C/C++)
Call as SysCall(C/ASM
Kernel/Driver Layer
(C/ASM)Project, 2006-2008
©SIProp

5
How to Build OpenCV for Android

©SIProp Project, 2006-2008

6
Download OpenCV & NDK tool
›

›

wget
https://github.com/Itseez/opencv/archive/
2.4.7.tar.gz
tar zxfv 2.4.7.tar.gz

› mkdir ~/android/
› cd ~/android/
› wget http://dl.google.com/android/androidsdk_r22.3-linux.tgz
› wget
http://dl.google.com/android/ndk/androidndk-r8e-linux-x86_64.tar.bz2
› tar zxfv android-sdk_r22.3-linux.tgz
› tar jxfv android-ndk-r8e-linuxx86_64.tar.bz2
©SIProp Project, 2006-2008

7
Edit Setup File
Add Android Source Code directory.
~/opencv2.4.7/platforms/scripts/cmake_android_service.sh
-DANDROID_SOURCE_TREE=~/nexus_work/android/
›

cmake DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.c
make -DANDROID_TOOLCHAIN_NAME="arm-linuxandroideabi-4.4.3" -DANDROID_STL=stlport_static DANDROID_STL_FORCE_FEATURES=OFF DBUILD_ANDROID_SERVICE=ON DANDROID_SOURCE_TREE=~/Projects/AndroidSource/Se
rviceStub/ $@ ../..

©SIProp Project, 2006-2008

8
Set Path to SDK/NDK

›
›

export ANDROID_NDK=~/android/androidndk-r8e
export ANDROID_SDK=~/android/androidsdk-linux

©SIProp Project, 2006-2008

9
Make Version File
Require “AndroidCamera” Func.
›

cp -v
~/nexus_work/android/development/sdk/pla
tform_source.prop_template
~/nexus_work/android/development/sdk/pla
tform_source.properties

Edit Version Number
›

Platform.Version=4.3.1

©SIProp Project, 2006-2008

10
Copy some haeder files & so Libs
Require “AndroidCamera” Func.
›

cp -aR ~/android/android-ndk-r8e/platforms/android14/arch-arm/usr/include/EGL ~/opencv2.4.7/modules/androidcamera/include/

›

cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibbinder.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/
cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibutils.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/
cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibandroid_runtime.so $(ANDROID_NDK)/platforms/android8/arch-arm/usr/lib/

›

›

©SIProp Project, 2006-2008

11
Modify Compile Option
~/opencv2.4.7/modules/androidcamera/CMakeLists.txt
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›

function(replace_compiler_option var old new)
# Replaces a compiler option or switch old in var by new.
# If old is not in var, appends new to var.
# Example: replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3"
"-O2")
# If the option already is on the variable, don't add it:
if( "${${var}}" MATCHES "(^| )${new}($| )" )
set(n "")
else()
set(n "${new}")
endif()
if( "${${var}}" MATCHES "(^| )${old}($| )" )
string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var} "${${var}}" )
else()
set( ${var} "${${var}} ${n}" )
endif()
set( ${var} "${${var}}" PARENT_SCOPE )
endfunction(replace_compiler_option)

›
›

replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
status("camera_wrapper C++ flags):" ${CMAKE_CXX_FLAGS})

©SIProp Project, 2006-2008

12
Include new Include File Dir
Android 4.3’s Include File Dir was separated.
~/opencv2.4.7/platforms/android/service/engine/CMakeLists.
txt
›

include_directories(SYSTEM
"${ANDROID_SOURCE_TREE}/frameworks/base/incl
ude"
"${ANDROID_SOURCE_TREE}/system/core/include"
)
"${ANDROID_SOURCE_TREE}/frameworks/native/inc
lude/"

©SIProp Project, 2006-2008

13
Delete "DetectTegra“ Func
This Android System doesn't have "Tegra“.
~/opencv2.4.7/platforms/android/service/engine/jni/BinderCo
mponent/TegraDetector.h
›

int DetectTegra(){};
↓
› int DetectTegra(){return NOT_TEGRA;};

©SIProp Project, 2006-2008

14
Make Define Log Func
Android Logging System was Changed…
Make 『FakeLog.h』 file
~/opencv2.4.7/platform/android/service/engine/jni/include/

1.
2.
3.
4.
5.
6.

#ifndef __FAKE_LOG_H__
#define __FAKE_LOG_H__
#define LOGD ALOGD
#define LOGI ALOGI
#define LOGE ALOGE
#endif

©SIProp Project, 2006-2008

15
Include Fake Log Header
~/opencv-2.4.7/platform/android/service/engine/jni/
BinderComponent/BnOpenCVEngine.h
BinderComponent/HardwareDetector.h
JNIWrapper/JavaBasedPackageManager.h
JNIWrapper/OpenCVLibraryInfo.h

1. #include "FakeLog.h"

©SIProp Project, 2006-2008

16
Execute Auto Config & make
This Script make Makefile for OpenCV.
In “~/opencv2.4.7/platforms/scripts/build_android_service”

› cd ~/opencv-2.4.7/platforms/scripts/
› ./cmake_android_service.sh

Make !!!
›

›

cd ~/opencv2.4.7/platforms/scripts/build_android_servic
e/
make
©SIProp Project, 2006-2008

17
Where are Made Files?
OpenCV Libs.
In “~/opencv2.4.7/platforms/build_android_service/lib”
highgui
core
etc...

3rd Party Libs for OpenCV.
In “~/opencv2.4.7/platforms/build_android_service/3rdparty/lib”
libIlmImf
libjasper
libjpeg
libpng
libtiff
©SIProp Project, 2006-2008

18
How to Build Android Camera

©SIProp Project, 2006-2008

19
Fix CMakeList.txt File 1/2
[OpenCV]/modules/androidcamera/CMakeList.t
xt
Required “-fno-rtti” Option
›
›
›
›
›
›
›
›
›
›
›
›
›

function(replace_compiler_option var old new)
if( "${${var}}" MATCHES "(^| )${new}($| )" )
set(n "")
else()
set(n "${new}")
endif()
if( "${${var}}" MATCHES "(^| )${old}($| )" )
string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var}
"${${var}}" )
else()
set( ${var} "${${var}} ${n}" )
endif()
set( ${var} "${${var}}" PARENT_SCOPE )
endfunction(replace_compiler_option)

›
›

replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
©SIProp
status("camera_wrapper C++ flags):" ${CMAKE_CXX_FLAGS}) Project, 2006-2008

20
Fix CMakeList.txt File 2/2
Add 2 Options
Please change “ANDROID_VERSION” to your Version.

›
›

SET(BUILD_ANDROID_CAMERA_WRAPPER ON)
SET(ANDROID_VERSION "4.3.0")

©SIProp Project, 2006-2008

21
Modify Android Camera Source Code
Android Camera Wrapper
[OpenCV
Source]modules/androidcamera/camera_wrapper/
camera_wrapper.cpp

If your camera doesn’t work, you should check
these source code:
Camera Service for Android Framework
[Android
Source]/frameworks/av/services/camera/libcameraservice
/
[Android Source]/frameworks/base/core/jni/

CameraHAL
[Android Source]/hardware/libhardware/modules/camera/
[Android Source]/hardware/[Vendor Name]/
©SIProp Project, 2006-2008

22
How to Use OpenCV for Android

©SIProp Project, 2006-2008

23
Native Application
NDK wo/ADT
Standard Android
Application for C/C++
Only C/C++ on Limited
Library Layer

Call Stack
APK File(Your Application)
(C/C++)

Advantage
Only C/C++
DirectCall C/C++ API

Dis-Advantage
Use a few Android Tools
A few Docs from Google
Developer Site & Blogs

Call as C/C++ APIs

Library Layer
(C/C++)
Call as SysCall(C/ASM
Kernel/Driver Layer
(C/ASM)Project, 2006-2008
©SIProp

24
Use NativeActivity of OpenCV
This Sample uses Only C/C++ Code.
~/opencv-2.4.7/samples/android/native-activity

Structure of NativeActivity
AndroidManifest.xml <- Property File for Android
res <- Directory that has Resource file(Image,Voice)
jni <- Directory that has files for NDK
Android.mk <- make file of NDK
Application.mk <- property file of NDK
native.cpp <- Sample App

Other Files/Dir, don’t use.
©SIProp Project, 2006-2008

25
Edit AndroidManifest.xml
Replace “application” Section
1.

<application android:label="@string/app_name"
android:hasCode="false">

2.
3.
4.

<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"

5.
6.
7.
8.
9.
10.
11.
12.
13.

android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="native_activity" />
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

©SIProp Project, 2006-2008

26
About AndroidManifest.xml
API Level
1.

<!-- This is the platform API where
NativeActivity was introduced. -->
2.
<uses-sdk android:minSdkVersion=“9" />

Permission
1.

<uses-permission
android:name="android.permission.CAMERA
"/>

©SIProp Project, 2006-2008

27
Edit jni/Application.xml
Change STL Lib
1. APP_STL := gnustl_static
↓
1. APP_STL := stlport_static

API Level
1. APP_PLATFORM := android-9

©SIProp Project, 2006-2008

28
Edit jni/Android.mk 1/8
Delete
1. include ../../sdk/native/jni/OpenCV.mk

Set OpenCV Libs
1. OPENCV_MODULES:=contrib legacy ml
stitching objdetect ts videostab video photo
calib3d features2d highgui imgproc flann
core androidcamera

©SIProp Project, 2006-2008

29
Edit jni/Android.mk 2/8
Make Loading OpenCV Libs Function
1. define add_opencv_module
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=opencv_$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar
meabi-v7a/libopencv_$1.a
5.
include $(PREBUILT_STATIC_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_MODULES),$(eval $(call
add_opencv_module,$(module))))
©SIProp Project, 2006-2008

30
Edit jni/Android.mk 3/8

Set 3rd Party Libs for OpenCV

1. OPENCV_3RDPARTY_COMPONENTS:=libjpe
g libpng libtiff libjasper IlmImf

©SIProp Project, 2006-2008

31
Edit jni/Android.mk 4/8
Make Loading OpenCV Libs Function
1. define add_opencv_3rdparty_component
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/3rdpar
ty/lib/armeabi-v7a/lib$1.a
5.
include $(PREBUILT_STATIC_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_3RDPARTY_COMPONEN
TS),$(eval $(call
add_opencv_3rdparty_component,$(module))))
©SIProp Project, 2006-2008

32
Edit jni/Android.mk 5/8

Set AndroidCamera Libs for OpenCV
1. OPENCV_CAMERA_MODULES:=
native_camera_r2.2.0 native_camera_r2.3.3
native_camera_r3.0.1 native_camera_r4.0.0
native_camera_r4.0.3 native_camera_r4.1.1
native_camera_r4.2.0 native_camera_r4.3.0

©SIProp Project, 2006-2008

33
Edit jni/Android.mk 6/8
Make Loading AndroidCamera Libs Function
1. define add_opencv_camera_module
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar
meabi-v7a/lib$1.so
5.
include $(PREBUILT_SHARED_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_CAMERA_MODULES),$(e
val $(call
add_opencv_camera_module,$(module))))
©SIProp Project, 2006-2008

34
Edit jni/Android.mk 7/8
Add Magic Word for Reset
1. include $(CLEAR_VARS)

Set Include Dir
1.
2.

OPENCV_INCLUDE_DIR:=$(LOCAL_DIR)/../opencv-2.4.7/include
LOCAL_C_INCLUDES+=$(OPENCV_INCLUDE_DIR)/opencv
$(OPENCV_INCLUDE_DIR)/opencv2 ../opencv2.4.7/modules/stitching/include ../opencv-2.4.7/modules/objdetect/include ../opencv2.4.7/modules/photo/include ../opencv-2.4.7/modules/flann/include ../opencv2.4.7/modules/core/include ../opencv-2.4.7/modules/ts/include ../opencv2.4.7/modules/highgui/include ../opencv-2.4.7/modules/contrib/include ../opencv2.4.7/modules/video/include ../opencv-2.4.7/modules/imgproc/include ../opencv2.4.7/modules/legacy/include ../opencv-2.4.7/modules/ocl/include ../opencv2.4.7/modules/features2d/include ../opencv-2.4.7/modules/calib3d/include ../opencv2.4.7/modules/ml/include ../opencv-2.4.7/modules/videostab ../opencv2.4.7/modules/nonfree/include ../opencv-2.4.7/modules/androidcamera/include

©SIProp Project, 2006-2008

35
Edit jni/Android.mk 8/8
Add Loading Lib & OpenCV Lib
LOCAL_LDLIBS
-lc -ldl -lz

LOCAL_STATIC_LIBRARIES
$(foreach mod, $(OPENCV_MODULES), opencv_$(mod))
$(OPENCV_3RDPARTY_COMPONENTS)

1. LOCAL_LDLIBS += -lm -llog -landroid -lc
-ldl -lz
2. LOCAL_STATIC_LIBRARIES :=
android_native_app_glue $(foreach mod,
$(OPENCV_MODULES), opencv_$(mod))
$(OPENCV_3RDPARTY_COMPONENTS)
©SIProp Project, 2006-2008

36
Setup/Make Build.xml 1/2
Making Setting File for Android using ANT
Today, Development on CUI Only!!!
Don’t use Eclipse!
›

android list target
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›

Available Android targets:
---------id: 1 or "android-9"
Name: Android 2.3.1
Type: Platform
API level: 9
Revision: 2
Skins: WQVGA400, QVGA, HVGA, WVGA800 (default), WVGA854
ABIs : armeabi
---------id: 2 or "android-18"
Name: Android 4.3
Type: Platform
API level: 18
Revision: 2
Skins: WXGA800, WQVGA400, QVGA, WQVGA432, WXGA800-7in, WVGA800
(default), HVGA, WXGA720, WSVGA, WVGA854
ABIs : armeabi-v7a
---------©SIProp Project, 2006-2008

37
Setup/Make Build.xml 2/2
Make Build.xml
› android update project --path . --target 2

©SIProp Project, 2006-2008

38
Build NativeActivity
Build C/C++ Source Codes
› ndk-build [clean all]

Make APK File
› ant [debug|release]

©SIProp Project, 2006-2008

39
Install NativeActivity.apk
Install APK File
› adb install bin/NativeActivity-debug.apk

UnInstall APK File
› adb uninstall com.example.native_activity

Show Log
› adb logcat
©SIProp Project, 2006-2008

40
adb(Android Debug Bridge)
Functions
Shell on Android Device
adb shell

Show Connected Android Devices
adb devices

Install/Uninstall APK File
adb install/uninstall [App Name]/[Package Name]

Send/Get File to/from Android Device
adb push/pull [from File Path] [to File Path]

Show Log (DDMS)
adb logcat

©SIProp Project, 2006-2008

41
How About NativeActivity

©SIProp Project, 2006-2008

42
Quick Explanation to NativeActivity
How to Use Camera
1.
2.
3.
4.
5.
6.
7.
8.

struct Engine
{
android_app* app;
cv::Ptr<cv::VideoCapture> capture;
};
(snip)
cv::Mat drawing_frame;
(snip)

9.

engine.capture->retrieve(drawing_frame,
CV_CAP_ANDROID_COLOR_FRAME_RGBA);

10.
11.

char buffer[256];
sprintf(buffer, "Display performance: %dx%d @ %.3f",
drawing_frame.cols, drawing_frame.rows, fps);
cv::putText(drawing_frame, std::string(buffer),
cv::Point(8,64),
cv::FONT_HERSHEY_COMPLEX_SMALL, 1,
cv::Scalar(0,255,0,255));
engine_draw_frame(&engine, drawing_frame);

12.
13.

14.

©SIProp Project, 2006-2008

43
Quick Explanation to NativeActivity
Event Driven Code for Android
1.
2.
3.
4.
5.
6.

static void engine_handle_cmd(android_app* app, int32_t cmd)
{
Engine* engine = (Engine*)app->userData;
switch (cmd)
{
(snip)

7.
8.
9.

void android_main(android_app* app)
{
Engine engine;

10.
11.
12.
13.
14.
15.
16.
17.

// Make sure glue isn't stripped.
app_dummy();
size_t engine_size = sizeof(engine);
memset((void*)&engine, 0, engine_size);
app->userData = &engine;
app->onAppCmd = engine_handle_cmd;
engine.app = app;
(snip)
©SIProp Project, 2006-2008

44
LifeCycle Diagram
Activity is Event Driven Arch
Main Event
onCreate()
Start Activity
Initialize Objects

onStart()
Finish Initialized

onPause()
Other Activity Start

onResume()
Back from Other Activity

onStop()
Don’t back long time
©SIProp Project, 2006-2008

45
But…
Some Android Camera doesn’t work…
#if !defined(ANDROID_r2_2_0) &&
!defined(ANDROID_r2_3_3) &&
!defined(ANDROID_r3_0_1) &&
!defined(ANDROID_r4_0_0) &&
!defined(ANDROID_r4_0_3) &&
!defined(ANDROID_r4_1_1) &&
!defined(ANDROID_r4_2_0) &&
!defined(ANDROID_r4_3_0)
# error Building camera wrapper for your version of Android
is not supported by OpenCV.
You need to modify OpenCV sources in order to compile
camera wrapper for your version of Android.
#endif
©SIProp Project, 2006-2008

46
Android Camera for Java
android.hardware.Camera
Android Framework’s Class

libcameraservice.so
libcamera_client.so
Absorption for Camera

CameraHardwareInterface
Hardware Camera

android.hardware.Camera
(Java)
Call as Android API

libCameraService.so
(C/C++)
Call as Shared Lib

libCamera_Client.so
(C/C++)
Call as ko Lib
CameraHardwareInterface
(C/ASM)
©SIProp Project, 2006-2008

47
Android Camera for OpenCV
Directly Call
Libcamera_client.so

Maybe Because…
They avoid overhead in
libcameraservice.so
libcamera_client.so

However…
Their Coding is original,
Some Devices don’t work.

native_camera_rx.x.x.so
(C/C++)
Call as Shared Lib

libCamera_Client.so
(C/C++)
Call as ko Lib
CameraHardwareInterface
(C/ASM)
©SIProp Project, 2006-2008

48
How to Add New Driver

©SIProp Project, 2006-2008

49
Kernel/Driver Layer
Android Source Tree
Ex. Nexus7(2013)
Device
Asus
flo
flo-kernel

Hardware
Qcom
audio
bt
camera
display
keymaster
media
msm8960
msm8x74
power
sensors
wlan

©SIProp Project, 2006-2008

50
How to Add V4L for OpenCV

©SIProp Project, 2006-2008

51
Why?
OpenCV for Android doesn’t have “V4L”.
It use Android build-in Camera.

Except Phone/Table don’t have Camera…
You MUST customize OpenCV for Android.

©SIProp Project, 2006-2008

52
Add New UVC Driver
drivers/media/video/uvc/uvc_driver.c
Add after “static struct usb_device_id uvc_ids[] = {“
1.
2.
3.
4.
5.
6.
7.
8.
9.

/* Etron Tech */
{ .match_flags
=
USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor
= 0x1e4e,
.idProduct
= 0x0104,
.bInterfaceClass
= USB_CLASS_VIDEO,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info
= UVC_QUIRK_PROBE_MINMAX },

©SIProp Project, 2006-2008

53
Download & Build kernel
Download & Build kernel
› cd ~/nexus_work
› export ARCH=arm
› export
CROSS_COMPILE=~/nexus_work/android/prebuilts/gc
c/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi› git clone
https://android.googlesource.com/kernel/msm.git -b
android-msm-flo-3.4-jb-mr2 kernel/nexus72
› cd kernel/nexus72
› make flo_defconfig
› make menuconfig
› make
› cp arch/arm/boot/zImage
~/nexus_work/android/device/asus/flo-kernel/kernel

©SIProp Project, 2006-2008

54
Change Permission
android/device/asus/flo/ueventd.flo.rc
Change “/dev/video*” Permission

› /dev/video*
camera

0666 system

©SIProp Project, 2006-2008

55
Re-Make OTA image
Re-Make OTA image
Require “clean”, because “init.*” doesn’t update.
›
›
›
›
›

cd ~/nexus_work/android/
source build/envsetup.sh
lunch aosp_flo-user
make clean
make otapackage

This file name is
aosp_flo-ota-eng.[your Linux’s User name].zip

©SIProp Project, 2006-2008

56
How to Build OpenCV for

V4L

Almost Same in “for Android”
Same Pages are Gray Out

©SIProp Project, 2006-2008

57
Download OpenCV & NDK tool
›

›

wget
https://github.com/Itseez/opencv/archive/
2.4.7.tar.gz
tar zxfv 2.4.7.tar.gz

› mkdir ~/android/
› cd ~/android/
› wget http://dl.google.com/android/androidsdk_r22.3-linux.tgz
› wget
http://dl.google.com/android/ndk/androidndk-r8e-linux-x86_64.tar.bz2
› tar zxfv android-sdk_r22.3-linux.tgz
› tar jxfv android-ndk-r8e-linuxx86_64.tar.bz2
©SIProp Project, 2006-2008

58
Edit Setup File
Add Android Source Code directory.
~/opencv2.4.7/platforms/scripts/cmake_android_service.sh
-DANDROID_SOURCE_TREE=~/nexus_work/android/
›

cmake DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.c
make -DANDROID_TOOLCHAIN_NAME="arm-linuxandroideabi-4.4.3" -DANDROID_STL=stlport_static DANDROID_STL_FORCE_FEATURES=OFF DBUILD_ANDROID_SERVICE=ON DANDROID_SOURCE_TREE=~/Projects/AndroidSource/Se
rviceStub/ $@ ../..

©SIProp Project, 2006-2008

59
Set Path to SDK/NDK

›
›

export ANDROID_NDK=~/android/androidndk-r8e
export ANDROID_SDK=~/android/androidsdk-linux

©SIProp Project, 2006-2008

60
Make Version File
Require “AndroidCamera” Func.
›

cp -v
~/nexus_work/android/development/sdk/pla
tform_source.prop_template
~/nexus_work/android/development/sdk/pla
tform_source.properties

Edit Version Number
›

Platform.Version=4.3.1

©SIProp Project, 2006-2008

61
Copy some haeder files & so Libs
Require “AndroidCamera” Func.
›

cp -aR ~/android/android-ndk-r8e/platforms/android14/arch-arm/usr/include/EGL ~/opencv2.4.7/modules/androidcamera/include/

›

cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibbinder.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/
cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibutils.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/
cp -v
~/nexus_work/android/out/target/product/flo/system/lib/l
ibandroid_runtime.so $(ANDROID_NDK)/platforms/android8/arch-arm/usr/lib/

›

›

©SIProp Project, 2006-2008

62
Include new Include File Dir
Android 4.3’s Include File Dir was separated.
~/opencv2.4.7/platforms/android/service/engine/CMakeLists.
txt
›

include_directories(SYSTEM
"${ANDROID_SOURCE_TREE}/frameworks/base/incl
ude"
"${ANDROID_SOURCE_TREE}/system/core/include"
)
"${ANDROID_SOURCE_TREE}/frameworks/native/inc
lude/"

©SIProp Project, 2006-2008

63
Delete "DetectTegra“ Func
This Android System doesn't have "Tegra“.
~/opencv2.4.7/platforms/android/service/engine/jni/BinderCo
mponent/TegraDetector.h
›

int DetectTegra(){};
↓
› int DetectTegra(){return NOT_TEGRA;};

©SIProp Project, 2006-2008

64
Make Define Log Func
Android Logging System was Changed…
Make 『FakeLog.h』 file
~/opencv2.4.7/platform/android/service/engine/jni/include/

1.
2.
3.
4.
5.
6.

#ifndef __FAKE_LOG_H__
#define __FAKE_LOG_H__
#define LOGD ALOGD
#define LOGI ALOGI
#define LOGE ALOGE
#endif

©SIProp Project, 2006-2008

65
Include Fake Log Header
~/opencv-2.4.7/platform/android/service/engine/jni/
BinderComponent/BnOpenCVEngine.h
BinderComponent/HardwareDetector.h
JNIWrapper/JavaBasedPackageManager.h
JNIWrapper/OpenCVLibraryInfo.h

1. #include "FakeLog.h"

©SIProp Project, 2006-2008

66
Comment Out AndroidCamera 1/2
OpenCV for Android ONLY use AndroidCamera.
~/opencv-2.4.7/modules/highgui/CMakeLists.txt
Change:

1. ocv_add_module(highgui opencv_imgproc
OPTIONAL opencv_androidcamera)
↓
1. ocv_add_module(highgui opencv_imgproc)
Delete:

1. list(APPEND highgui_srcs
src/cap_android.cpp)
©SIProp Project, 2006-2008

67
Comment Out AndroidCamera 2/2
OpenCV for Android ONLY use AndroidCamera.
~/opencv2.4.7/modules/androidcamera/CMakeLists.txt
Delete:

1. ocv_module_disable(androidcamera)

©SIProp Project, 2006-2008

68
Comment in V4L 1/2
Enabel V4L in highgui.
~/opencv-2.4.7/modules/highgui/CMakeLists.txt
Add:

1. list(APPEND highgui_srcs src/cap_libv4l.cpp)
2. list(APPEND highgui_srcs src/cap_v4l.cpp)
~/opencv-2.4.7/modules/highgui/src/cap.cpp
Add in under Functions:
“CV_IMPL CvCapture * cvCreateCameraCapture (int index)”

1. return cvCreateCameraCapture_V4L (index);

©SIProp Project, 2006-2008

69
Comment in V4L 2/2
-DWITH_V4L=ON doesn't work...
~/opencv-2.4.7/modules/highgui/src/cap.cpp
~/opencv-2.4.7/modules/highgui/src/cap_libv4l.cpp

1. #define HAVE_CAMV4L
2. #define HAVE_CAMV4L2
3. #define HAVE_LIBV4L

©SIProp Project, 2006-2008

70
Copy V4L Header Files
›
›
›
›

cp -v /usr/include/libv4l1.h ~/opencv2.4.7/modules/highgui/include/
cp -v /usr/include/libv4l2.h ~/opencv2.4.7/modules/highgui/include/
cp -v /usr/include/libv4lconvert.h
~/opencv-2.4.7/modules/highgui/include/
cp -v /usr/include/libv4l1-videodev.h
~/opencv-2.4.7/modules/highgui/include/

©SIProp Project, 2006-2008

71
Delete Java Lib
This Lib require AndroidCamera
› rm -fr ~/opencv-2.4.7/modules/java/

©SIProp Project, 2006-2008

72
Execute Auto Config & make
This Script make Makefile for OpenCV.
In “~/opencv2.4.7/platforms/scripts/build_android_service”

› cd ~/opencv-2.4.7/platforms/scripts/
› ./cmake_android_service.sh

Make !!!
›

›

cd ~/opencv2.4.7/platforms/scripts/build_android_servic
e/
make
©SIProp Project, 2006-2008

73
Where are Made Files?
OpenCV Libs.
In “~/opencv2.4.7/platforms/build_android_service/lib”
highgui
core
etc...

3rd Party Libs for OpenCV.
In “~/opencv2.4.7/platforms/build_android_service/3rdparty/lib”
libIlmImf
libjasper
libjpeg
libpng
libtiff
©SIProp Project, 2006-2008

74
How to Use OpenCV for V4L
Almost Same in “for Android”
Same Pages are Gray Out

©SIProp Project, 2006-2008

75
Use NativeActivity of OpenCV
This Sample uses Only C/C++ Code.
~/opencv-2.4.7/samples/android/native-activity

Structure of NativeActivity
AndroidManifest.xml <- Property File for Android
res <- Directory that has Resource file(Image,Voice)
jni <- Directory that has files for NDK
Android.mk <- make file of NDK
Application.mk <- property file of NDK
native.cpp <- Sample App

Other Files/Dir, don’t use.
©SIProp Project, 2006-2008

76
Edit AndroidManifest.xml
Replace “application” Section
1.

<application android:label="@string/app_name"
android:hasCode="false">

2.
3.
4.

<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"

5.
6.
7.
8.
9.
10.
11.
12.
13.

android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="native_activity" />
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

©SIProp Project, 2006-2008

77
About AndroidManifest.xml
API Level
1.

<!-- This is the platform API where
NativeActivity was introduced. -->
2.
<uses-sdk android:minSdkVersion=“9" />

Permission
1.

<uses-permission
android:name="android.permission.CAMERA
"/>

©SIProp Project, 2006-2008

78
Edit jni/Application.xml
Change STL Lib
1. APP_STL := gnustl_static
↓
1. APP_STL := stlport_static

API Level
1. APP_PLATFORM := android-9

©SIProp Project, 2006-2008

79
Edit jni/Android.mk 1/8
Delete
1. include ../../sdk/native/jni/OpenCV.mk

Set OpenCV Libs
1. OPENCV_MODULES:=contrib legacy ml
stitching objdetect ts videostab video photo
calib3d features2d highgui imgproc flann
core androidcamera

©SIProp Project, 2006-2008

80
Edit jni/Android.mk 2/8
Make Loading OpenCV Libs Function
1. define add_opencv_module
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=opencv_$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar
meabi-v7a/libopencv_$1.a
5.
include $(PREBUILT_STATIC_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_MODULES),$(eval $(call
add_opencv_module,$(module))))
©SIProp Project, 2006-2008

81
Edit jni/Android.mk 3/8

Set 3rd Party Libs for OpenCV

1. OPENCV_3RDPARTY_COMPONENTS:=libjpe
g libpng libtiff libjasper IlmImf

©SIProp Project, 2006-2008

82
Edit jni/Android.mk 4/8
Make Loading OpenCV Libs Function
1. define add_opencv_3rdparty_component
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/3rdpar
ty/lib/armeabi-v7a/lib$1.a
5.
include $(PREBUILT_STATIC_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_3RDPARTY_COMPONEN
TS),$(eval $(call
add_opencv_3rdparty_component,$(module))))
©SIProp Project, 2006-2008

83
Edit jni/Android.mk 7/8
Add Magic Word for Reset
1. include $(CLEAR_VARS)

Set Include Dir
1.
2.

OPENCV_INCLUDE_DIR:=$(LOCAL_DIR)/../opencv-2.4.7/include
LOCAL_C_INCLUDES+=$(OPENCV_INCLUDE_DIR)/opencv
$(OPENCV_INCLUDE_DIR)/opencv2 ../opencv2.4.7/modules/stitching/include ../opencv-2.4.7/modules/objdetect/include ../opencv2.4.7/modules/photo/include ../opencv-2.4.7/modules/flann/include ../opencv2.4.7/modules/core/include ../opencv-2.4.7/modules/ts/include ../opencv2.4.7/modules/highgui/include ../opencv-2.4.7/modules/contrib/include ../opencv2.4.7/modules/video/include ../opencv-2.4.7/modules/imgproc/include ../opencv2.4.7/modules/legacy/include ../opencv-2.4.7/modules/ocl/include ../opencv2.4.7/modules/features2d/include ../opencv-2.4.7/modules/calib3d/include ../opencv2.4.7/modules/ml/include ../opencv-2.4.7/modules/videostab ../opencv2.4.7/modules/nonfree/include ../opencv-2.4.7/modules/androidcamera/include

©SIProp Project, 2006-2008

84
Edit jni/Android.mk 8/8
Add Loading Lib & OpenCV Lib
LOCAL_LDLIBS
-lc -ldl -lz

LOCAL_STATIC_LIBRARIES
$(foreach mod, $(OPENCV_MODULES), opencv_$(mod))
$(OPENCV_3RDPARTY_COMPONENTS)

1. LOCAL_LDLIBS += -lm -llog -landroid -lc
-ldl -lz
2. LOCAL_STATIC_LIBRARIES :=
android_native_app_glue $(foreach mod,
$(OPENCV_MODULES), opencv_$(mod))
$(OPENCV_3RDPARTY_COMPONENTS)
©SIProp Project, 2006-2008

85
Setup libv4l for Android
Download libv4l Lib for Android
›

wget
http://www.noritsuna.com/download/libv4l_f
or_android.tar.gz

Set libv4l Lib to NDK
UnPacked & Copy to:
1. $(ANDROID_NDK)/source/opencv/

©SIProp Project, 2006-2008

86
Edit jni/Android.mk Ext-1
Add libv4l Lib in:
1. LOCAL_STATIC_LIBRARIES :=
android_native_app_glue $(foreach mod,
$(OPENCV_MODULES), opencv_$(mod))
$(OPENCV_3RDPARTY_COMPONENTS)
opencv_libv4l

Add import-module Func in Last Line
1. $(call import-module,opencv/libv4l)

©SIProp Project, 2006-2008

87
Edit jni/Android.mk Ext-2
If you edited about “AndroidCamera” Libs,
Please Delete it!
Delete AndroidCamera Libs for OpenCV
1. OPENCV_CAMERA_MODULES:=
native_camera_r2.2.0 native_camera_r2.3.3
native_camera_r3.0.1 native_camera_r4.0.0
native_camera_r4.0.3 native_camera_r4.1.1
native_camera_r4.2.0 native_camera_r4.3.0

©SIProp Project, 2006-2008

88
Edit jni/Android.mk Ext-3
Delete Loading AndroidCamera Libs Function
1. define add_opencv_camera_module
2.
include $(CLEAR_VARS)
3.
LOCAL_MODULE:=$1
4.
LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar
meabi-v7a/lib$1.so
5.
include $(PREBUILT_SHARED_LIBRARY)
6. endef
1. $(foreach
module,$(OPENCV_CAMERA_MODULES),$(e
val $(call
add_opencv_camera_module,$(module))))
©SIProp Project, 2006-2008

89
Setup/Make Build.xml 1/2
Making Setting File for Android using ANT
Today, Development on CUI Only!!!
Don’t use Eclipse!
›

android list target
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›
›

Available Android targets:
---------id: 1 or "android-9"
Name: Android 2.3.1
Type: Platform
API level: 9
Revision: 2
Skins: WQVGA400, QVGA, HVGA, WVGA800 (default), WVGA854
ABIs : armeabi
---------id: 2 or "android-18"
Name: Android 4.3
Type: Platform
API level: 18
Revision: 2
Skins: WXGA800, WQVGA400, QVGA, WQVGA432, WXGA800-7in, WVGA800
(default), HVGA, WXGA720, WSVGA, WVGA854
ABIs : armeabi-v7a
---------©SIProp Project, 2006-2008

90
Setup/Make Build.xml 2/2
Make Build.xml
› android update project --path . --target 2

©SIProp Project, 2006-2008

91
Build NativeActivity
Build C/C++ Source Codes
› ndk-build [clean all]

Make APK File
› ant [debug|release]

©SIProp Project, 2006-2008

92
Install NativeActivity.apk
Install APK File
› adb install bin/NativeActivity-debug.apk

UnInstall APK File
› adb uninstall com.example.native_activity

Show Log
› adb logcat
©SIProp Project, 2006-2008

93
How to Add New Native App

©SIProp Project, 2006-2008

94
How to Develop?
As Linux Application
Non-Standard Android
Application
Full Linux C/C++ on
Library Layer

Call Stack
ELF File(Your Application)
(C/C++)

Advantage
Use Other Linux Libs

Dis-Advantage
Must Modify Android
System
How to Modify on next
Lecture

Call as C/C++ APIs

Library Layer + Linux Libs
(C/C++)
Call as SysCall(C/ASM
Kernel/Driver Layer
(C/ASM)Project, 2006-2008
©SIProp

95
Make Execute File
Make Dir
hello-exe/
hello-exe/jni

Make Source Code: hello-exe/jni/hello-exe.c
1. #include <stdio.h>
2. int main(int argc, char ** argv) {
3.
printf("Hello, world!n");
4.
return 0;
5. }

©SIProp Project, 2006-2008

96
Make Execute File
Make Android.mk
1. jni/Android.mk
2. LOCAL_PATH := $(call my-dir)
3. include $(CLEAR_VARS)
4. LOCAL_MODULE := hello-exe
5. LOCAL_SRC_FILES := hello-exe.c
6. include $(BUILD_EXECUTABLE)

©SIProp Project, 2006-2008

97
Build Execute File
Build C/C++ Source Codes
› ndk-build [clean all]

Setup & Execute Execute File
›
›
›
›
›

adb push obj/local/armeabi/hello-exe /bin/
adb shell
$ cd bin
$ chmod +x hello-exe
./hello-exe
Required “root permission”
©SIProp Project, 2006-2008

98
Setup Exe File with OTA-Build
init.*.rc in Nexus7(2013)
~/nexus_work/android/device/asus/flo/init.flo.rc

Copy your program to OTA-Package
~/nexus_work/android/build/target/product/mini.mk
PRODUCT_COPY_FILES += 
[local program path]:[system path]

Ex.
PRODUCT_COPY_FILES += 
external/myapp/bin/myapp:system/usr/bin/myapp

©SIProp Project, 2006-2008

99
Init Script on Android
init.*.rc
Auto Run on Boot Format:
service [program name] [program path] [program option]…
[service option]
.

Ex:
service irsc_util /system/bin/logwrapper /system/bin/irsc_util
"/etc/sec_config"
class main <- service group
user root <- run user or [group xxx]
oneshot <- run once

Change user/group/permission
chown/chmod
Ex:
chmod 0777 /bin/myapp

©SIProp Project, 2006-2008

100
Boot Up Flow Kernel~Android System
Init
Set Permission
Mount Disks
Load Driver

Demons
Linux App

Zygote
Sharing
JavaResource
Manager

Runtime
Linux SO
Driver

©SIProp Project, 2006-2008

101
Appendix: How to Setup so File
If you want to use your so file.
How to Setup:
Copy so file to:
PRODUCT_COPY_FILES += 
external/myso/bin/libmyso.so:system/lib/libmyso.so

How to Use:
With NDK. In “Android.mk”:
LOCAL_LDLIBS := -lmyso

©SIProp Project, 2006-2008

102

Weitere ähnliche Inhalte

Was ist angesagt?

GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN GolangBo-Yi Wu
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevDroidConTLV
 
Drone 1.0 Feature
Drone 1.0 FeatureDrone 1.0 Feature
Drone 1.0 FeatureBo-Yi Wu
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Eugene Kurko
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerGraham Charters
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesChris Bailey
 
Build microservice with gRPC in golang
Build microservice with gRPC in golangBuild microservice with gRPC in golang
Build microservice with gRPC in golangTing-Li Chou
 
Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0Cherie Williams
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Building kubectl plugins with Quarkus | DevNation Tech Talk
Building kubectl plugins with Quarkus | DevNation Tech TalkBuilding kubectl plugins with Quarkus | DevNation Tech Talk
Building kubectl plugins with Quarkus | DevNation Tech TalkRed Hat Developers
 
Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondRamon Ribeiro Rabello
 
Gearman work queue in php
Gearman work queue in phpGearman work queue in php
Gearman work queue in phpBo-Yi Wu
 
[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the androidJun Liu
 
Test your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementTest your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementBaiju Muthukadan
 
Paving the way to a native Sling
Paving the way to a native SlingPaving the way to a native Sling
Paving the way to a native SlingRadu Cotescu
 
Startup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionStartup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionJuraj Michálek
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf Conference
 
iOSDC 2018 動画をなめらかに動かす技術
iOSDC 2018 動画をなめらかに動かす技術iOSDC 2018 動画をなめらかに動かす技術
iOSDC 2018 動画をなめらかに動かす技術Yuji Hato
 

Was ist angesagt? (20)

GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
 
Drone 1.0 Feature
Drone 1.0 FeatureDrone 1.0 Feature
Drone 1.0 Feature
 
GO-CFを試してみる
GO-CFを試してみるGO-CFを試してみる
GO-CFを試してみる
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Optimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for DockerOptimizing Spring Boot apps for Docker
Optimizing Spring Boot apps for Docker
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
 
Build microservice with gRPC in golang
Build microservice with gRPC in golangBuild microservice with gRPC in golang
Build microservice with gRPC in golang
 
Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Building kubectl plugins with Quarkus | DevNation Tech Talk
Building kubectl plugins with Quarkus | DevNation Tech TalkBuilding kubectl plugins with Quarkus | DevNation Tech Talk
Building kubectl plugins with Quarkus | DevNation Tech Talk
 
Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyond
 
Gearman work queue in php
Gearman work queue in phpGearman work queue in php
Gearman work queue in php
 
[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android
 
Test your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementTest your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle Management
 
Paving the way to a native Sling
Paving the way to a native SlingPaving the way to a native Sling
Paving the way to a native Sling
 
Startup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django sessionStartup Camp - Git, Python, Django session
Startup Camp - Git, Python, Django session
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
iOSDC 2018 動画をなめらかに動かす技術
iOSDC 2018 動画をなめらかに動かす技術iOSDC 2018 動画をなめらかに動かす技術
iOSDC 2018 動画をなめらかに動かす技術
 

Andere mochten auch

node-gypを使ったネイティブモジュールの作成
node-gypを使ったネイティブモジュールの作成node-gypを使ったネイティブモジュールの作成
node-gypを使ったネイティブモジュールの作成shigeki_ohtsu
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on AndroidGary Bisson
 
RIL and Android Telephony
RIL and Android TelephonyRIL and Android Telephony
RIL and Android TelephonyLeaf Johnson
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer InterfaceChun-Yu Wang
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Xavier Hallade
 

Andere mochten auch (6)

node-gypを使ったネイティブモジュールの作成
node-gypを使ったネイティブモジュールの作成node-gypを使ったネイティブモジュールの作成
node-gypを使ったネイティブモジュールの作成
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 
PublishSubject
PublishSubjectPublishSubject
PublishSubject
 
RIL and Android Telephony
RIL and Android TelephonyRIL and Android Telephony
RIL and Android Telephony
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer Interface
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 

Ähnlich wie How to Add Original Library to Android NDK

Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With YouDalibor Gogic
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionFelipe Prado
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forCorneil du Plessis
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfRahulRoy130127
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsMykyta Protsenko
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Hitchhiker's guide to the front end development
Hitchhiker's guide to the front end developmentHitchhiker's guide to the front end development
Hitchhiker's guide to the front end development정윤 김
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupalAndrii Podanenko
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly LanguageMotaz Saad
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebMikel Torres Ugarte
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기경주 전
 

Ähnlich wie How to Add Original Library to Android NDK (20)

Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
EC2
EC2EC2
EC2
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With You
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdf
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and Ops
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Hitchhiker's guide to the front end development
Hitchhiker's guide to the front end developmentHitchhiker's guide to the front end development
Hitchhiker's guide to the front end development
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupal
 
Serverless and React
Serverless and ReactServerless and React
Serverless and React
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 

Mehr von Industrial Technology Research Institute (ITRI)(工業技術研究院, 工研院)

Mehr von Industrial Technology Research Institute (ITRI)(工業技術研究院, 工研院) (20)

What is the world where you can make your own semiconductors?
What is the world where you can make your own semiconductors?What is the world where you can make your own semiconductors?
What is the world where you can make your own semiconductors?
 
半導体製造(TinyTapeout)に挑戦しよう!
半導体製造(TinyTapeout)に挑戦しよう!半導体製造(TinyTapeout)に挑戦しよう!
半導体製造(TinyTapeout)に挑戦しよう!
 
Introduction of ISHI-KAI with OpenMPW
Introduction of ISHI-KAI with OpenMPWIntroduction of ISHI-KAI with OpenMPW
Introduction of ISHI-KAI with OpenMPW
 
Kernel/VMレイヤーを自分色に染める!By ISHI会
Kernel/VMレイヤーを自分色に染める!By ISHI会Kernel/VMレイヤーを自分色に染める!By ISHI会
Kernel/VMレイヤーを自分色に染める!By ISHI会
 
Principle Representation of The 8 Qubits Quantum Computer by RaspberryPi
Principle Representation of The 8 Qubits Quantum Computer by RaspberryPiPrinciple Representation of The 8 Qubits Quantum Computer by RaspberryPi
Principle Representation of The 8 Qubits Quantum Computer by RaspberryPi
 
Microwaveguquantum
MicrowaveguquantumMicrowaveguquantum
Microwaveguquantum
 
The easiest way of setup QuTiP on Windows
The easiest way of setup QuTiP on WindowsThe easiest way of setup QuTiP on Windows
The easiest way of setup QuTiP on Windows
 
GNU Radio Study for Super beginner
GNU Radio Study for Super beginnerGNU Radio Study for Super beginner
GNU Radio Study for Super beginner
 
The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3
The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3
The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3
 
Self‐Contained SDR Grand Station with Raspberry Pi 3
Self‐Contained SDR Grand Station with Raspberry Pi 3Self‐Contained SDR Grand Station with Raspberry Pi 3
Self‐Contained SDR Grand Station with Raspberry Pi 3
 
衛星追尾用パラボラアンテナ建設記
衛星追尾用パラボラアンテナ建設記衛星追尾用パラボラアンテナ建設記
衛星追尾用パラボラアンテナ建設記
 
All list of the measuring machines for microwave
All list of the measuring machines for microwaveAll list of the measuring machines for microwave
All list of the measuring machines for microwave
 
5000円で誰でも作れる新世代衛星地上局
5000円で誰でも作れる新世代衛星地上局5000円で誰でも作れる新世代衛星地上局
5000円で誰でも作れる新世代衛星地上局
 
How to setup mastodon in chinese
How to setup mastodon in chineseHow to setup mastodon in chinese
How to setup mastodon in chinese
 
Radiation Test -Raspberry PI Zero-
Radiation Test -Raspberry PI Zero-Radiation Test -Raspberry PI Zero-
Radiation Test -Raspberry PI Zero-
 
將DNA在廚房抽出的程序
將DNA在廚房抽出的程序將DNA在廚房抽出的程序
將DNA在廚房抽出的程序
 
Protocol of the DNA Extraction in Kitchen
Protocol of the DNA Extraction in KitchenProtocol of the DNA Extraction in Kitchen
Protocol of the DNA Extraction in Kitchen
 
OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...
OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...
OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...
 
Zedroid - Android (5.0 and later) on Zedboard
Zedroid - Android (5.0 and later) on ZedboardZedroid - Android (5.0 and later) on Zedboard
Zedroid - Android (5.0 and later) on Zedboard
 
3D Printed Google Cardboard for workshop
3D Printed Google Cardboard for workshop3D Printed Google Cardboard for workshop
3D Printed Google Cardboard for workshop
 

Kürzlich hochgeladen

Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 

Kürzlich hochgeladen (20)

Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 

How to Add Original Library to Android NDK

  • 1. How to Add Original Library to Android NDK Noritsuna Imamura noritsuna@siprop.org ©SIProp Project, 2006-2008 1
  • 2. Agenda How to Add Original Library to Android NDK Build OpenCV Only C/C++ World on Android ©SIProp Project, 2006-2008 2
  • 3. How to Add New Library ©SIProp Project, 2006-2008 3
  • 4. Library Layer Linux Software & Linux Library aac android-clat android-mock ant-glob antlr apache-harmony apache-http apache-qp apache-xml arduino bison blktrace bluetooth bouncycastle bsdiff bzip2 ceres-solver checkpolicy chromium chromium-libpac chromium-trace chromium_org clang compiler-rt dexmaker dhcpcd dnsmasq doclava droiddriver dropbear e2fsprogs easymock eclipse-basebuilder eclipse-windowbuilder eigen elfutils embunit emma esd expat eyes-free fdlibm flac freetype fsck_msdos ganymed-ssh2 gcc-demangle genext2fs giflib google-diff-match-patch grub gtest guava hamcrest harfbuzz harfbuzz_ng hyphenation icu4c iproute2 ipsec-tools iptables iputils jack javasqlite javassist jdiff jhead jmdns jmonkeyengine jpeg jsilver jsr305 junit kernel-headers libcap-ng libffi libgsm liblzf libmtp libnfc-nci libnfc-nxp libnl-headers libogg libpcap libphonenumber libpng libppp libselinux libsepol libusb libusb-compat libvorbis libvpx libxml2 libxslt libyuv linux-tools-perf littlemock llvm lzma marisa-trie markdown mdnsresponder mesa3d mksh mockito mockwebserver mp4parser mtpd naver-fonts netcat netperf neven nist-pkits nist-sip noto-fonts oauth objenesis okhttp open-vcdiff opencv openfst openssh openssl tinycompress oprofile tinyxml pixman tinyxml2 ppp tremolo proguard v8 protobuf valgrind qemu webp qemu-pc-bios webrtc regex-re2 wpa_supplicant_8 replicaisland xmlwriter robolectric xmp_toolkit safe-iop yaffs2 scrypt zlib sepolicy zxing sfntly sil-fonts skia smack smali sonivox speex sqlite srec srtp stlport strace stressapptest svox tagsoup tcpdump timezonepicker-support tinyalsa ©SIProp Project, 2006-2008 4
  • 5. How to Develop? NDK wo/ADT Standard Android Application for C/C++ Only C/C++ on Limited Library Layer Call Stack APK File(Your Application) (C/C++) Advantage Only C/C++ DirectCall C/C++ API Dis-Advantage Use a few Android Tools A few Docs from Google Developer Site & Blogs Call as C/C++ APIs Library Layer (C/C++) Call as SysCall(C/ASM Kernel/Driver Layer (C/ASM)Project, 2006-2008 ©SIProp 5
  • 6. How to Build OpenCV for Android ©SIProp Project, 2006-2008 6
  • 7. Download OpenCV & NDK tool › › wget https://github.com/Itseez/opencv/archive/ 2.4.7.tar.gz tar zxfv 2.4.7.tar.gz › mkdir ~/android/ › cd ~/android/ › wget http://dl.google.com/android/androidsdk_r22.3-linux.tgz › wget http://dl.google.com/android/ndk/androidndk-r8e-linux-x86_64.tar.bz2 › tar zxfv android-sdk_r22.3-linux.tgz › tar jxfv android-ndk-r8e-linuxx86_64.tar.bz2 ©SIProp Project, 2006-2008 7
  • 8. Edit Setup File Add Android Source Code directory. ~/opencv2.4.7/platforms/scripts/cmake_android_service.sh -DANDROID_SOURCE_TREE=~/nexus_work/android/ › cmake DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.c make -DANDROID_TOOLCHAIN_NAME="arm-linuxandroideabi-4.4.3" -DANDROID_STL=stlport_static DANDROID_STL_FORCE_FEATURES=OFF DBUILD_ANDROID_SERVICE=ON DANDROID_SOURCE_TREE=~/Projects/AndroidSource/Se rviceStub/ $@ ../.. ©SIProp Project, 2006-2008 8
  • 9. Set Path to SDK/NDK › › export ANDROID_NDK=~/android/androidndk-r8e export ANDROID_SDK=~/android/androidsdk-linux ©SIProp Project, 2006-2008 9
  • 10. Make Version File Require “AndroidCamera” Func. › cp -v ~/nexus_work/android/development/sdk/pla tform_source.prop_template ~/nexus_work/android/development/sdk/pla tform_source.properties Edit Version Number › Platform.Version=4.3.1 ©SIProp Project, 2006-2008 10
  • 11. Copy some haeder files & so Libs Require “AndroidCamera” Func. › cp -aR ~/android/android-ndk-r8e/platforms/android14/arch-arm/usr/include/EGL ~/opencv2.4.7/modules/androidcamera/include/ › cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibbinder.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/ cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibutils.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/ cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibandroid_runtime.so $(ANDROID_NDK)/platforms/android8/arch-arm/usr/lib/ › › ©SIProp Project, 2006-2008 11
  • 12. Modify Compile Option ~/opencv2.4.7/modules/androidcamera/CMakeLists.txt › › › › › › › › › › › › › › › › › function(replace_compiler_option var old new) # Replaces a compiler option or switch old in var by new. # If old is not in var, appends new to var. # Example: replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") # If the option already is on the variable, don't add it: if( "${${var}}" MATCHES "(^| )${new}($| )" ) set(n "") else() set(n "${new}") endif() if( "${${var}}" MATCHES "(^| )${old}($| )" ) string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var} "${${var}}" ) else() set( ${var} "${${var}} ${n}" ) endif() set( ${var} "${${var}}" PARENT_SCOPE ) endfunction(replace_compiler_option) › › replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti") status("camera_wrapper C++ flags):" ${CMAKE_CXX_FLAGS}) ©SIProp Project, 2006-2008 12
  • 13. Include new Include File Dir Android 4.3’s Include File Dir was separated. ~/opencv2.4.7/platforms/android/service/engine/CMakeLists. txt › include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/incl ude" "${ANDROID_SOURCE_TREE}/system/core/include" ) "${ANDROID_SOURCE_TREE}/frameworks/native/inc lude/" ©SIProp Project, 2006-2008 13
  • 14. Delete "DetectTegra“ Func This Android System doesn't have "Tegra“. ~/opencv2.4.7/platforms/android/service/engine/jni/BinderCo mponent/TegraDetector.h › int DetectTegra(){}; ↓ › int DetectTegra(){return NOT_TEGRA;}; ©SIProp Project, 2006-2008 14
  • 15. Make Define Log Func Android Logging System was Changed… Make 『FakeLog.h』 file ~/opencv2.4.7/platform/android/service/engine/jni/include/ 1. 2. 3. 4. 5. 6. #ifndef __FAKE_LOG_H__ #define __FAKE_LOG_H__ #define LOGD ALOGD #define LOGI ALOGI #define LOGE ALOGE #endif ©SIProp Project, 2006-2008 15
  • 16. Include Fake Log Header ~/opencv-2.4.7/platform/android/service/engine/jni/ BinderComponent/BnOpenCVEngine.h BinderComponent/HardwareDetector.h JNIWrapper/JavaBasedPackageManager.h JNIWrapper/OpenCVLibraryInfo.h 1. #include "FakeLog.h" ©SIProp Project, 2006-2008 16
  • 17. Execute Auto Config & make This Script make Makefile for OpenCV. In “~/opencv2.4.7/platforms/scripts/build_android_service” › cd ~/opencv-2.4.7/platforms/scripts/ › ./cmake_android_service.sh Make !!! › › cd ~/opencv2.4.7/platforms/scripts/build_android_servic e/ make ©SIProp Project, 2006-2008 17
  • 18. Where are Made Files? OpenCV Libs. In “~/opencv2.4.7/platforms/build_android_service/lib” highgui core etc... 3rd Party Libs for OpenCV. In “~/opencv2.4.7/platforms/build_android_service/3rdparty/lib” libIlmImf libjasper libjpeg libpng libtiff ©SIProp Project, 2006-2008 18
  • 19. How to Build Android Camera ©SIProp Project, 2006-2008 19
  • 20. Fix CMakeList.txt File 1/2 [OpenCV]/modules/androidcamera/CMakeList.t xt Required “-fno-rtti” Option › › › › › › › › › › › › › function(replace_compiler_option var old new) if( "${${var}}" MATCHES "(^| )${new}($| )" ) set(n "") else() set(n "${new}") endif() if( "${${var}}" MATCHES "(^| )${old}($| )" ) string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var} "${${var}}" ) else() set( ${var} "${${var}} ${n}" ) endif() set( ${var} "${${var}}" PARENT_SCOPE ) endfunction(replace_compiler_option) › › replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti") ©SIProp status("camera_wrapper C++ flags):" ${CMAKE_CXX_FLAGS}) Project, 2006-2008 20
  • 21. Fix CMakeList.txt File 2/2 Add 2 Options Please change “ANDROID_VERSION” to your Version. › › SET(BUILD_ANDROID_CAMERA_WRAPPER ON) SET(ANDROID_VERSION "4.3.0") ©SIProp Project, 2006-2008 21
  • 22. Modify Android Camera Source Code Android Camera Wrapper [OpenCV Source]modules/androidcamera/camera_wrapper/ camera_wrapper.cpp If your camera doesn’t work, you should check these source code: Camera Service for Android Framework [Android Source]/frameworks/av/services/camera/libcameraservice / [Android Source]/frameworks/base/core/jni/ CameraHAL [Android Source]/hardware/libhardware/modules/camera/ [Android Source]/hardware/[Vendor Name]/ ©SIProp Project, 2006-2008 22
  • 23. How to Use OpenCV for Android ©SIProp Project, 2006-2008 23
  • 24. Native Application NDK wo/ADT Standard Android Application for C/C++ Only C/C++ on Limited Library Layer Call Stack APK File(Your Application) (C/C++) Advantage Only C/C++ DirectCall C/C++ API Dis-Advantage Use a few Android Tools A few Docs from Google Developer Site & Blogs Call as C/C++ APIs Library Layer (C/C++) Call as SysCall(C/ASM Kernel/Driver Layer (C/ASM)Project, 2006-2008 ©SIProp 24
  • 25. Use NativeActivity of OpenCV This Sample uses Only C/C++ Code. ~/opencv-2.4.7/samples/android/native-activity Structure of NativeActivity AndroidManifest.xml <- Property File for Android res <- Directory that has Resource file(Image,Voice) jni <- Directory that has files for NDK Android.mk <- make file of NDK Application.mk <- property file of NDK native.cpp <- Sample App Other Files/Dir, don’t use. ©SIProp Project, 2006-2008 25
  • 26. Edit AndroidManifest.xml Replace “application” Section 1. <application android:label="@string/app_name" android:hasCode="false"> 2. 3. 4. <activity android:name="android.app.NativeActivity" android:label="@string/app_name" 5. 6. 7. 8. 9. 10. 11. 12. 13. android:configChanges="orientation|keyboardHidden"> <!-- Tell NativeActivity the name of or .so --> <meta-data android:name="android.app.lib_name" android:value="native_activity" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> ©SIProp Project, 2006-2008 26
  • 27. About AndroidManifest.xml API Level 1. <!-- This is the platform API where NativeActivity was introduced. --> 2. <uses-sdk android:minSdkVersion=“9" /> Permission 1. <uses-permission android:name="android.permission.CAMERA "/> ©SIProp Project, 2006-2008 27
  • 28. Edit jni/Application.xml Change STL Lib 1. APP_STL := gnustl_static ↓ 1. APP_STL := stlport_static API Level 1. APP_PLATFORM := android-9 ©SIProp Project, 2006-2008 28
  • 29. Edit jni/Android.mk 1/8 Delete 1. include ../../sdk/native/jni/OpenCV.mk Set OpenCV Libs 1. OPENCV_MODULES:=contrib legacy ml stitching objdetect ts videostab video photo calib3d features2d highgui imgproc flann core androidcamera ©SIProp Project, 2006-2008 29
  • 30. Edit jni/Android.mk 2/8 Make Loading OpenCV Libs Function 1. define add_opencv_module 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=opencv_$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar meabi-v7a/libopencv_$1.a 5. include $(PREBUILT_STATIC_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_MODULES),$(eval $(call add_opencv_module,$(module)))) ©SIProp Project, 2006-2008 30
  • 31. Edit jni/Android.mk 3/8 Set 3rd Party Libs for OpenCV 1. OPENCV_3RDPARTY_COMPONENTS:=libjpe g libpng libtiff libjasper IlmImf ©SIProp Project, 2006-2008 31
  • 32. Edit jni/Android.mk 4/8 Make Loading OpenCV Libs Function 1. define add_opencv_3rdparty_component 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/3rdpar ty/lib/armeabi-v7a/lib$1.a 5. include $(PREBUILT_STATIC_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_3RDPARTY_COMPONEN TS),$(eval $(call add_opencv_3rdparty_component,$(module)))) ©SIProp Project, 2006-2008 32
  • 33. Edit jni/Android.mk 5/8 Set AndroidCamera Libs for OpenCV 1. OPENCV_CAMERA_MODULES:= native_camera_r2.2.0 native_camera_r2.3.3 native_camera_r3.0.1 native_camera_r4.0.0 native_camera_r4.0.3 native_camera_r4.1.1 native_camera_r4.2.0 native_camera_r4.3.0 ©SIProp Project, 2006-2008 33
  • 34. Edit jni/Android.mk 6/8 Make Loading AndroidCamera Libs Function 1. define add_opencv_camera_module 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar meabi-v7a/lib$1.so 5. include $(PREBUILT_SHARED_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_CAMERA_MODULES),$(e val $(call add_opencv_camera_module,$(module)))) ©SIProp Project, 2006-2008 34
  • 35. Edit jni/Android.mk 7/8 Add Magic Word for Reset 1. include $(CLEAR_VARS) Set Include Dir 1. 2. OPENCV_INCLUDE_DIR:=$(LOCAL_DIR)/../opencv-2.4.7/include LOCAL_C_INCLUDES+=$(OPENCV_INCLUDE_DIR)/opencv $(OPENCV_INCLUDE_DIR)/opencv2 ../opencv2.4.7/modules/stitching/include ../opencv-2.4.7/modules/objdetect/include ../opencv2.4.7/modules/photo/include ../opencv-2.4.7/modules/flann/include ../opencv2.4.7/modules/core/include ../opencv-2.4.7/modules/ts/include ../opencv2.4.7/modules/highgui/include ../opencv-2.4.7/modules/contrib/include ../opencv2.4.7/modules/video/include ../opencv-2.4.7/modules/imgproc/include ../opencv2.4.7/modules/legacy/include ../opencv-2.4.7/modules/ocl/include ../opencv2.4.7/modules/features2d/include ../opencv-2.4.7/modules/calib3d/include ../opencv2.4.7/modules/ml/include ../opencv-2.4.7/modules/videostab ../opencv2.4.7/modules/nonfree/include ../opencv-2.4.7/modules/androidcamera/include ©SIProp Project, 2006-2008 35
  • 36. Edit jni/Android.mk 8/8 Add Loading Lib & OpenCV Lib LOCAL_LDLIBS -lc -ldl -lz LOCAL_STATIC_LIBRARIES $(foreach mod, $(OPENCV_MODULES), opencv_$(mod)) $(OPENCV_3RDPARTY_COMPONENTS) 1. LOCAL_LDLIBS += -lm -llog -landroid -lc -ldl -lz 2. LOCAL_STATIC_LIBRARIES := android_native_app_glue $(foreach mod, $(OPENCV_MODULES), opencv_$(mod)) $(OPENCV_3RDPARTY_COMPONENTS) ©SIProp Project, 2006-2008 36
  • 37. Setup/Make Build.xml 1/2 Making Setting File for Android using ANT Today, Development on CUI Only!!! Don’t use Eclipse! › android list target › › › › › › › › › › › › › › › › › › Available Android targets: ---------id: 1 or "android-9" Name: Android 2.3.1 Type: Platform API level: 9 Revision: 2 Skins: WQVGA400, QVGA, HVGA, WVGA800 (default), WVGA854 ABIs : armeabi ---------id: 2 or "android-18" Name: Android 4.3 Type: Platform API level: 18 Revision: 2 Skins: WXGA800, WQVGA400, QVGA, WQVGA432, WXGA800-7in, WVGA800 (default), HVGA, WXGA720, WSVGA, WVGA854 ABIs : armeabi-v7a ---------©SIProp Project, 2006-2008 37
  • 38. Setup/Make Build.xml 2/2 Make Build.xml › android update project --path . --target 2 ©SIProp Project, 2006-2008 38
  • 39. Build NativeActivity Build C/C++ Source Codes › ndk-build [clean all] Make APK File › ant [debug|release] ©SIProp Project, 2006-2008 39
  • 40. Install NativeActivity.apk Install APK File › adb install bin/NativeActivity-debug.apk UnInstall APK File › adb uninstall com.example.native_activity Show Log › adb logcat ©SIProp Project, 2006-2008 40
  • 41. adb(Android Debug Bridge) Functions Shell on Android Device adb shell Show Connected Android Devices adb devices Install/Uninstall APK File adb install/uninstall [App Name]/[Package Name] Send/Get File to/from Android Device adb push/pull [from File Path] [to File Path] Show Log (DDMS) adb logcat ©SIProp Project, 2006-2008 41
  • 42. How About NativeActivity ©SIProp Project, 2006-2008 42
  • 43. Quick Explanation to NativeActivity How to Use Camera 1. 2. 3. 4. 5. 6. 7. 8. struct Engine { android_app* app; cv::Ptr<cv::VideoCapture> capture; }; (snip) cv::Mat drawing_frame; (snip) 9. engine.capture->retrieve(drawing_frame, CV_CAP_ANDROID_COLOR_FRAME_RGBA); 10. 11. char buffer[256]; sprintf(buffer, "Display performance: %dx%d @ %.3f", drawing_frame.cols, drawing_frame.rows, fps); cv::putText(drawing_frame, std::string(buffer), cv::Point(8,64), cv::FONT_HERSHEY_COMPLEX_SMALL, 1, cv::Scalar(0,255,0,255)); engine_draw_frame(&engine, drawing_frame); 12. 13. 14. ©SIProp Project, 2006-2008 43
  • 44. Quick Explanation to NativeActivity Event Driven Code for Android 1. 2. 3. 4. 5. 6. static void engine_handle_cmd(android_app* app, int32_t cmd) { Engine* engine = (Engine*)app->userData; switch (cmd) { (snip) 7. 8. 9. void android_main(android_app* app) { Engine engine; 10. 11. 12. 13. 14. 15. 16. 17. // Make sure glue isn't stripped. app_dummy(); size_t engine_size = sizeof(engine); memset((void*)&engine, 0, engine_size); app->userData = &engine; app->onAppCmd = engine_handle_cmd; engine.app = app; (snip) ©SIProp Project, 2006-2008 44
  • 45. LifeCycle Diagram Activity is Event Driven Arch Main Event onCreate() Start Activity Initialize Objects onStart() Finish Initialized onPause() Other Activity Start onResume() Back from Other Activity onStop() Don’t back long time ©SIProp Project, 2006-2008 45
  • 46. But… Some Android Camera doesn’t work… #if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && !defined(ANDROID_r4_2_0) && !defined(ANDROID_r4_3_0) # error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android. #endif ©SIProp Project, 2006-2008 46
  • 47. Android Camera for Java android.hardware.Camera Android Framework’s Class libcameraservice.so libcamera_client.so Absorption for Camera CameraHardwareInterface Hardware Camera android.hardware.Camera (Java) Call as Android API libCameraService.so (C/C++) Call as Shared Lib libCamera_Client.so (C/C++) Call as ko Lib CameraHardwareInterface (C/ASM) ©SIProp Project, 2006-2008 47
  • 48. Android Camera for OpenCV Directly Call Libcamera_client.so Maybe Because… They avoid overhead in libcameraservice.so libcamera_client.so However… Their Coding is original, Some Devices don’t work. native_camera_rx.x.x.so (C/C++) Call as Shared Lib libCamera_Client.so (C/C++) Call as ko Lib CameraHardwareInterface (C/ASM) ©SIProp Project, 2006-2008 48
  • 49. How to Add New Driver ©SIProp Project, 2006-2008 49
  • 50. Kernel/Driver Layer Android Source Tree Ex. Nexus7(2013) Device Asus flo flo-kernel Hardware Qcom audio bt camera display keymaster media msm8960 msm8x74 power sensors wlan ©SIProp Project, 2006-2008 50
  • 51. How to Add V4L for OpenCV ©SIProp Project, 2006-2008 51
  • 52. Why? OpenCV for Android doesn’t have “V4L”. It use Android build-in Camera. Except Phone/Table don’t have Camera… You MUST customize OpenCV for Android. ©SIProp Project, 2006-2008 52
  • 53. Add New UVC Driver drivers/media/video/uvc/uvc_driver.c Add after “static struct usb_device_id uvc_ids[] = {“ 1. 2. 3. 4. 5. 6. 7. 8. 9. /* Etron Tech */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x1e4e, .idProduct = 0x0104, .bInterfaceClass = USB_CLASS_VIDEO, .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_QUIRK_PROBE_MINMAX }, ©SIProp Project, 2006-2008 53
  • 54. Download & Build kernel Download & Build kernel › cd ~/nexus_work › export ARCH=arm › export CROSS_COMPILE=~/nexus_work/android/prebuilts/gc c/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi› git clone https://android.googlesource.com/kernel/msm.git -b android-msm-flo-3.4-jb-mr2 kernel/nexus72 › cd kernel/nexus72 › make flo_defconfig › make menuconfig › make › cp arch/arm/boot/zImage ~/nexus_work/android/device/asus/flo-kernel/kernel ©SIProp Project, 2006-2008 54
  • 55. Change Permission android/device/asus/flo/ueventd.flo.rc Change “/dev/video*” Permission › /dev/video* camera 0666 system ©SIProp Project, 2006-2008 55
  • 56. Re-Make OTA image Re-Make OTA image Require “clean”, because “init.*” doesn’t update. › › › › › cd ~/nexus_work/android/ source build/envsetup.sh lunch aosp_flo-user make clean make otapackage This file name is aosp_flo-ota-eng.[your Linux’s User name].zip ©SIProp Project, 2006-2008 56
  • 57. How to Build OpenCV for V4L Almost Same in “for Android” Same Pages are Gray Out ©SIProp Project, 2006-2008 57
  • 58. Download OpenCV & NDK tool › › wget https://github.com/Itseez/opencv/archive/ 2.4.7.tar.gz tar zxfv 2.4.7.tar.gz › mkdir ~/android/ › cd ~/android/ › wget http://dl.google.com/android/androidsdk_r22.3-linux.tgz › wget http://dl.google.com/android/ndk/androidndk-r8e-linux-x86_64.tar.bz2 › tar zxfv android-sdk_r22.3-linux.tgz › tar jxfv android-ndk-r8e-linuxx86_64.tar.bz2 ©SIProp Project, 2006-2008 58
  • 59. Edit Setup File Add Android Source Code directory. ~/opencv2.4.7/platforms/scripts/cmake_android_service.sh -DANDROID_SOURCE_TREE=~/nexus_work/android/ › cmake DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.c make -DANDROID_TOOLCHAIN_NAME="arm-linuxandroideabi-4.4.3" -DANDROID_STL=stlport_static DANDROID_STL_FORCE_FEATURES=OFF DBUILD_ANDROID_SERVICE=ON DANDROID_SOURCE_TREE=~/Projects/AndroidSource/Se rviceStub/ $@ ../.. ©SIProp Project, 2006-2008 59
  • 60. Set Path to SDK/NDK › › export ANDROID_NDK=~/android/androidndk-r8e export ANDROID_SDK=~/android/androidsdk-linux ©SIProp Project, 2006-2008 60
  • 61. Make Version File Require “AndroidCamera” Func. › cp -v ~/nexus_work/android/development/sdk/pla tform_source.prop_template ~/nexus_work/android/development/sdk/pla tform_source.properties Edit Version Number › Platform.Version=4.3.1 ©SIProp Project, 2006-2008 61
  • 62. Copy some haeder files & so Libs Require “AndroidCamera” Func. › cp -aR ~/android/android-ndk-r8e/platforms/android14/arch-arm/usr/include/EGL ~/opencv2.4.7/modules/androidcamera/include/ › cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibbinder.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/ cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibutils.so $(ANDROID_NDK)/platforms/android-8/archarm/usr/lib/ cp -v ~/nexus_work/android/out/target/product/flo/system/lib/l ibandroid_runtime.so $(ANDROID_NDK)/platforms/android8/arch-arm/usr/lib/ › › ©SIProp Project, 2006-2008 62
  • 63. Include new Include File Dir Android 4.3’s Include File Dir was separated. ~/opencv2.4.7/platforms/android/service/engine/CMakeLists. txt › include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/incl ude" "${ANDROID_SOURCE_TREE}/system/core/include" ) "${ANDROID_SOURCE_TREE}/frameworks/native/inc lude/" ©SIProp Project, 2006-2008 63
  • 64. Delete "DetectTegra“ Func This Android System doesn't have "Tegra“. ~/opencv2.4.7/platforms/android/service/engine/jni/BinderCo mponent/TegraDetector.h › int DetectTegra(){}; ↓ › int DetectTegra(){return NOT_TEGRA;}; ©SIProp Project, 2006-2008 64
  • 65. Make Define Log Func Android Logging System was Changed… Make 『FakeLog.h』 file ~/opencv2.4.7/platform/android/service/engine/jni/include/ 1. 2. 3. 4. 5. 6. #ifndef __FAKE_LOG_H__ #define __FAKE_LOG_H__ #define LOGD ALOGD #define LOGI ALOGI #define LOGE ALOGE #endif ©SIProp Project, 2006-2008 65
  • 66. Include Fake Log Header ~/opencv-2.4.7/platform/android/service/engine/jni/ BinderComponent/BnOpenCVEngine.h BinderComponent/HardwareDetector.h JNIWrapper/JavaBasedPackageManager.h JNIWrapper/OpenCVLibraryInfo.h 1. #include "FakeLog.h" ©SIProp Project, 2006-2008 66
  • 67. Comment Out AndroidCamera 1/2 OpenCV for Android ONLY use AndroidCamera. ~/opencv-2.4.7/modules/highgui/CMakeLists.txt Change: 1. ocv_add_module(highgui opencv_imgproc OPTIONAL opencv_androidcamera) ↓ 1. ocv_add_module(highgui opencv_imgproc) Delete: 1. list(APPEND highgui_srcs src/cap_android.cpp) ©SIProp Project, 2006-2008 67
  • 68. Comment Out AndroidCamera 2/2 OpenCV for Android ONLY use AndroidCamera. ~/opencv2.4.7/modules/androidcamera/CMakeLists.txt Delete: 1. ocv_module_disable(androidcamera) ©SIProp Project, 2006-2008 68
  • 69. Comment in V4L 1/2 Enabel V4L in highgui. ~/opencv-2.4.7/modules/highgui/CMakeLists.txt Add: 1. list(APPEND highgui_srcs src/cap_libv4l.cpp) 2. list(APPEND highgui_srcs src/cap_v4l.cpp) ~/opencv-2.4.7/modules/highgui/src/cap.cpp Add in under Functions: “CV_IMPL CvCapture * cvCreateCameraCapture (int index)” 1. return cvCreateCameraCapture_V4L (index); ©SIProp Project, 2006-2008 69
  • 70. Comment in V4L 2/2 -DWITH_V4L=ON doesn't work... ~/opencv-2.4.7/modules/highgui/src/cap.cpp ~/opencv-2.4.7/modules/highgui/src/cap_libv4l.cpp 1. #define HAVE_CAMV4L 2. #define HAVE_CAMV4L2 3. #define HAVE_LIBV4L ©SIProp Project, 2006-2008 70
  • 71. Copy V4L Header Files › › › › cp -v /usr/include/libv4l1.h ~/opencv2.4.7/modules/highgui/include/ cp -v /usr/include/libv4l2.h ~/opencv2.4.7/modules/highgui/include/ cp -v /usr/include/libv4lconvert.h ~/opencv-2.4.7/modules/highgui/include/ cp -v /usr/include/libv4l1-videodev.h ~/opencv-2.4.7/modules/highgui/include/ ©SIProp Project, 2006-2008 71
  • 72. Delete Java Lib This Lib require AndroidCamera › rm -fr ~/opencv-2.4.7/modules/java/ ©SIProp Project, 2006-2008 72
  • 73. Execute Auto Config & make This Script make Makefile for OpenCV. In “~/opencv2.4.7/platforms/scripts/build_android_service” › cd ~/opencv-2.4.7/platforms/scripts/ › ./cmake_android_service.sh Make !!! › › cd ~/opencv2.4.7/platforms/scripts/build_android_servic e/ make ©SIProp Project, 2006-2008 73
  • 74. Where are Made Files? OpenCV Libs. In “~/opencv2.4.7/platforms/build_android_service/lib” highgui core etc... 3rd Party Libs for OpenCV. In “~/opencv2.4.7/platforms/build_android_service/3rdparty/lib” libIlmImf libjasper libjpeg libpng libtiff ©SIProp Project, 2006-2008 74
  • 75. How to Use OpenCV for V4L Almost Same in “for Android” Same Pages are Gray Out ©SIProp Project, 2006-2008 75
  • 76. Use NativeActivity of OpenCV This Sample uses Only C/C++ Code. ~/opencv-2.4.7/samples/android/native-activity Structure of NativeActivity AndroidManifest.xml <- Property File for Android res <- Directory that has Resource file(Image,Voice) jni <- Directory that has files for NDK Android.mk <- make file of NDK Application.mk <- property file of NDK native.cpp <- Sample App Other Files/Dir, don’t use. ©SIProp Project, 2006-2008 76
  • 77. Edit AndroidManifest.xml Replace “application” Section 1. <application android:label="@string/app_name" android:hasCode="false"> 2. 3. 4. <activity android:name="android.app.NativeActivity" android:label="@string/app_name" 5. 6. 7. 8. 9. 10. 11. 12. 13. android:configChanges="orientation|keyboardHidden"> <!-- Tell NativeActivity the name of or .so --> <meta-data android:name="android.app.lib_name" android:value="native_activity" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> ©SIProp Project, 2006-2008 77
  • 78. About AndroidManifest.xml API Level 1. <!-- This is the platform API where NativeActivity was introduced. --> 2. <uses-sdk android:minSdkVersion=“9" /> Permission 1. <uses-permission android:name="android.permission.CAMERA "/> ©SIProp Project, 2006-2008 78
  • 79. Edit jni/Application.xml Change STL Lib 1. APP_STL := gnustl_static ↓ 1. APP_STL := stlport_static API Level 1. APP_PLATFORM := android-9 ©SIProp Project, 2006-2008 79
  • 80. Edit jni/Android.mk 1/8 Delete 1. include ../../sdk/native/jni/OpenCV.mk Set OpenCV Libs 1. OPENCV_MODULES:=contrib legacy ml stitching objdetect ts videostab video photo calib3d features2d highgui imgproc flann core androidcamera ©SIProp Project, 2006-2008 80
  • 81. Edit jni/Android.mk 2/8 Make Loading OpenCV Libs Function 1. define add_opencv_module 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=opencv_$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar meabi-v7a/libopencv_$1.a 5. include $(PREBUILT_STATIC_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_MODULES),$(eval $(call add_opencv_module,$(module)))) ©SIProp Project, 2006-2008 81
  • 82. Edit jni/Android.mk 3/8 Set 3rd Party Libs for OpenCV 1. OPENCV_3RDPARTY_COMPONENTS:=libjpe g libpng libtiff libjasper IlmImf ©SIProp Project, 2006-2008 82
  • 83. Edit jni/Android.mk 4/8 Make Loading OpenCV Libs Function 1. define add_opencv_3rdparty_component 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/3rdpar ty/lib/armeabi-v7a/lib$1.a 5. include $(PREBUILT_STATIC_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_3RDPARTY_COMPONEN TS),$(eval $(call add_opencv_3rdparty_component,$(module)))) ©SIProp Project, 2006-2008 83
  • 84. Edit jni/Android.mk 7/8 Add Magic Word for Reset 1. include $(CLEAR_VARS) Set Include Dir 1. 2. OPENCV_INCLUDE_DIR:=$(LOCAL_DIR)/../opencv-2.4.7/include LOCAL_C_INCLUDES+=$(OPENCV_INCLUDE_DIR)/opencv $(OPENCV_INCLUDE_DIR)/opencv2 ../opencv2.4.7/modules/stitching/include ../opencv-2.4.7/modules/objdetect/include ../opencv2.4.7/modules/photo/include ../opencv-2.4.7/modules/flann/include ../opencv2.4.7/modules/core/include ../opencv-2.4.7/modules/ts/include ../opencv2.4.7/modules/highgui/include ../opencv-2.4.7/modules/contrib/include ../opencv2.4.7/modules/video/include ../opencv-2.4.7/modules/imgproc/include ../opencv2.4.7/modules/legacy/include ../opencv-2.4.7/modules/ocl/include ../opencv2.4.7/modules/features2d/include ../opencv-2.4.7/modules/calib3d/include ../opencv2.4.7/modules/ml/include ../opencv-2.4.7/modules/videostab ../opencv2.4.7/modules/nonfree/include ../opencv-2.4.7/modules/androidcamera/include ©SIProp Project, 2006-2008 84
  • 85. Edit jni/Android.mk 8/8 Add Loading Lib & OpenCV Lib LOCAL_LDLIBS -lc -ldl -lz LOCAL_STATIC_LIBRARIES $(foreach mod, $(OPENCV_MODULES), opencv_$(mod)) $(OPENCV_3RDPARTY_COMPONENTS) 1. LOCAL_LDLIBS += -lm -llog -landroid -lc -ldl -lz 2. LOCAL_STATIC_LIBRARIES := android_native_app_glue $(foreach mod, $(OPENCV_MODULES), opencv_$(mod)) $(OPENCV_3RDPARTY_COMPONENTS) ©SIProp Project, 2006-2008 85
  • 86. Setup libv4l for Android Download libv4l Lib for Android › wget http://www.noritsuna.com/download/libv4l_f or_android.tar.gz Set libv4l Lib to NDK UnPacked & Copy to: 1. $(ANDROID_NDK)/source/opencv/ ©SIProp Project, 2006-2008 86
  • 87. Edit jni/Android.mk Ext-1 Add libv4l Lib in: 1. LOCAL_STATIC_LIBRARIES := android_native_app_glue $(foreach mod, $(OPENCV_MODULES), opencv_$(mod)) $(OPENCV_3RDPARTY_COMPONENTS) opencv_libv4l Add import-module Func in Last Line 1. $(call import-module,opencv/libv4l) ©SIProp Project, 2006-2008 87
  • 88. Edit jni/Android.mk Ext-2 If you edited about “AndroidCamera” Libs, Please Delete it! Delete AndroidCamera Libs for OpenCV 1. OPENCV_CAMERA_MODULES:= native_camera_r2.2.0 native_camera_r2.3.3 native_camera_r3.0.1 native_camera_r4.0.0 native_camera_r4.0.3 native_camera_r4.1.1 native_camera_r4.2.0 native_camera_r4.3.0 ©SIProp Project, 2006-2008 88
  • 89. Edit jni/Android.mk Ext-3 Delete Loading AndroidCamera Libs Function 1. define add_opencv_camera_module 2. include $(CLEAR_VARS) 3. LOCAL_MODULE:=$1 4. LOCAL_SRC_FILES:=../../opencv2.4.7/platforms/build_android_service/lib/ar meabi-v7a/lib$1.so 5. include $(PREBUILT_SHARED_LIBRARY) 6. endef 1. $(foreach module,$(OPENCV_CAMERA_MODULES),$(e val $(call add_opencv_camera_module,$(module)))) ©SIProp Project, 2006-2008 89
  • 90. Setup/Make Build.xml 1/2 Making Setting File for Android using ANT Today, Development on CUI Only!!! Don’t use Eclipse! › android list target › › › › › › › › › › › › › › › › › › Available Android targets: ---------id: 1 or "android-9" Name: Android 2.3.1 Type: Platform API level: 9 Revision: 2 Skins: WQVGA400, QVGA, HVGA, WVGA800 (default), WVGA854 ABIs : armeabi ---------id: 2 or "android-18" Name: Android 4.3 Type: Platform API level: 18 Revision: 2 Skins: WXGA800, WQVGA400, QVGA, WQVGA432, WXGA800-7in, WVGA800 (default), HVGA, WXGA720, WSVGA, WVGA854 ABIs : armeabi-v7a ---------©SIProp Project, 2006-2008 90
  • 91. Setup/Make Build.xml 2/2 Make Build.xml › android update project --path . --target 2 ©SIProp Project, 2006-2008 91
  • 92. Build NativeActivity Build C/C++ Source Codes › ndk-build [clean all] Make APK File › ant [debug|release] ©SIProp Project, 2006-2008 92
  • 93. Install NativeActivity.apk Install APK File › adb install bin/NativeActivity-debug.apk UnInstall APK File › adb uninstall com.example.native_activity Show Log › adb logcat ©SIProp Project, 2006-2008 93
  • 94. How to Add New Native App ©SIProp Project, 2006-2008 94
  • 95. How to Develop? As Linux Application Non-Standard Android Application Full Linux C/C++ on Library Layer Call Stack ELF File(Your Application) (C/C++) Advantage Use Other Linux Libs Dis-Advantage Must Modify Android System How to Modify on next Lecture Call as C/C++ APIs Library Layer + Linux Libs (C/C++) Call as SysCall(C/ASM Kernel/Driver Layer (C/ASM)Project, 2006-2008 ©SIProp 95
  • 96. Make Execute File Make Dir hello-exe/ hello-exe/jni Make Source Code: hello-exe/jni/hello-exe.c 1. #include <stdio.h> 2. int main(int argc, char ** argv) { 3. printf("Hello, world!n"); 4. return 0; 5. } ©SIProp Project, 2006-2008 96
  • 97. Make Execute File Make Android.mk 1. jni/Android.mk 2. LOCAL_PATH := $(call my-dir) 3. include $(CLEAR_VARS) 4. LOCAL_MODULE := hello-exe 5. LOCAL_SRC_FILES := hello-exe.c 6. include $(BUILD_EXECUTABLE) ©SIProp Project, 2006-2008 97
  • 98. Build Execute File Build C/C++ Source Codes › ndk-build [clean all] Setup & Execute Execute File › › › › › adb push obj/local/armeabi/hello-exe /bin/ adb shell $ cd bin $ chmod +x hello-exe ./hello-exe Required “root permission” ©SIProp Project, 2006-2008 98
  • 99. Setup Exe File with OTA-Build init.*.rc in Nexus7(2013) ~/nexus_work/android/device/asus/flo/init.flo.rc Copy your program to OTA-Package ~/nexus_work/android/build/target/product/mini.mk PRODUCT_COPY_FILES += [local program path]:[system path] Ex. PRODUCT_COPY_FILES += external/myapp/bin/myapp:system/usr/bin/myapp ©SIProp Project, 2006-2008 99
  • 100. Init Script on Android init.*.rc Auto Run on Boot Format: service [program name] [program path] [program option]… [service option] . Ex: service irsc_util /system/bin/logwrapper /system/bin/irsc_util "/etc/sec_config" class main <- service group user root <- run user or [group xxx] oneshot <- run once Change user/group/permission chown/chmod Ex: chmod 0777 /bin/myapp ©SIProp Project, 2006-2008 100
  • 101. Boot Up Flow Kernel~Android System Init Set Permission Mount Disks Load Driver Demons Linux App Zygote Sharing JavaResource Manager Runtime Linux SO Driver ©SIProp Project, 2006-2008 101
  • 102. Appendix: How to Setup so File If you want to use your so file. How to Setup: Copy so file to: PRODUCT_COPY_FILES += external/myso/bin/libmyso.so:system/lib/libmyso.so How to Use: With NDK. In “Android.mk”: LOCAL_LDLIBS := -lmyso ©SIProp Project, 2006-2008 102