[轉載請註明出處] http://kezeodsnx.pixnet.net/blog

作者: kezeodsnx

安裝

下載完後,解壓縮:

root@user-ubuntu:/home/user/temp/source/blog# ls
android-ndk-1.5_r1-linux-x86.zip
root@user-ubuntu:/home/user/temp/source/blog# unzip android-ndk-1.5_r1-linux-x86.zip
Archive:  android-ndk-1.5_r1-linux-x86.zip
   creating: android-ndk-1.5_r1/
      :

在NDK的top執行./build/host-setup.sh

root@user-ubuntu:/home/user/temp/source/blog/android-ndk-1.5_r1# bash ./build/host-setup.sh
Detecting host toolchain.

CC         : compiler check ok (gcc)
LD         : linker check ok (gcc)
CXX        : C++ compiler check ok (g++)
Generate   : out/host/config.mk
Toolchain  : Checking for arm-eabi-4.2.1 prebuilt binaries

Host setup complete. Please read docs/OVERVIEW.TXT if you don't know what to do.

這樣就裝好了。再來就make了:

root@user-ubuntu:/home/user/temp/source/blog/android-ndk-1.5_r1# make APP=two-libs
Android NDK: Building for application 'two-libs'   
Compile thumb  : twolib-second <= sources/samples/two-libs/second.c
Compile thumb  : twolib-first <= sources/samples/two-libs/first.c
StaticLibrary  : libtwolib-first.a
SharedLibrary  : libtwolib-second.so
Install        : libtwolib-second.so => apps/two-libs/project/libs/armeabi

可看出library已被正確的安裝到應用程式了。此時可以打開eclipse,將這個project import進來,然後放到emulator上跑看看:

import 

library的位置:

import1

 

模擬器執行情況

import2

 

kezeodsnx 發表在 痞客邦 PIXNET 留言(0) 人氣()