18
Android NDK ( Native Development Kit ) 2014. 10. 28 Version : 1.0.0 made by 최대우 R&D 1Team

제 4회 DGMIT R&D 컨퍼런스 : Android NDK

Embed Size (px)

DESCRIPTION

1. Android NDK란? 2. Android 개발환경 구축하기 3. How to make Header Flie?

Citation preview

Page 1: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

Android NDK

( Native Development Kit )

2014. 10. 28

Version : 1.0.0

made by 최대우R&D 1Team

Page 2: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

2

CONTENTS.

1. Android NDK란 ? ……………… 3

2. Android NDK개발환경 구축하기 ……………… 4

2.1) Let’s install Android NDK ……………… 4

2.2) Set Environment for Android NDK …………… 6

3. How to make Header File? …………….. 9

3.1) Let’s learn from Build Example Project ..... 10

Page 3: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

3

1. Android NDK란 ?What is Android NDK?

Why using Android NDK?

- Reuse- Access on Device- Performance

Page 4: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

4

2. Android NDK개발환경 구축하기2.1) Let’s install Android NDK

1. Downloads Android NDK- http://developer.android.com/tools/sdk/ndk

Page 5: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

5

2. Android NDK개발환경 구축하기

3. Then, “cmd“ is coming out and run Install !

2. Just Start this exe File !

2.1) Let’s install Android NDK

Page 6: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

6

2. Android NDK개발환경 구축하기

1. Window → Preferences

Open Preferences

2. Android → NDK NDK Location:Set the Path which your“ndk“ file is exist.

2.2) Set Environment for Android NDK

Page 7: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

7

2. Android NDK개발환경 구축하기

3. Run-> External Tools ->External Tools Configurations

2.2) Set Environment for Android NDK

Page 8: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

4. Location:

Click Browse File System

and

Set Path which your javah.exe

8

2. Android NDK개발환경 구축하기2.2) Set Environment for Android NDK

Page 9: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

9

3. How to make Header File?

1. Make Example Project for Explain Make Header File

3.1) Let’s learn from Build Example Project

2. Right Mouse Click on Project andAndroid Tools -> Add Native Support

3. Write Your Library(.so) Name You Want!

Page 10: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

10

3. How to make Header File?

5. Make New Class in “src” folder for JNI

3.1) Let’s learn from Build Example Project

4. You Can See “jni” Folder is Created.

Page 11: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

11

3. How to make Header File?3.1) Let’s learn from Build Example Project

6. Working Directory: Click Browse Workspace and Select Your Project

7. Arguments: Write this!-d ${workspace_loc:/프로젝트명/jni} -classpath ${workspace_loc:/프로젝트명/src} NDK 개발 클래스 패키지 풀네임

Page 12: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

12

3. How to make Header File?3.1) Let’s learn from Build Example Project

8. Go to Refresh tap and Check “Refresh resources upon completion”.Check the Radio Button of “Specific resources”, and Click “Specify Resources”

9. Check Your Project and Click “Finish” Button.

Page 13: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

13

3. How to make Header File?

10. If you done successfully, Your console will send message to you.

3.1) Let’s learn from Build Example Project

11. Header file is created in your “jni” folder.

Page 14: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

14

3. How to make Header File?

12. In your header file, define some method which you wanna use.

3.1) Let’s learn from Build Example Project

JNIEXPORT return타입 JNICALL JAVA_패키지풀네임_메소드명

Page 15: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

15

3. How to make Header File?

13. In your .cpp file, define your method’s operate

3.1) Let’s learn from Build Example Project

14. In your “Library”.java file,LoadLibrary your .cpp in static{},

and

define method with “native returnTypewhich you want use.

Page 16: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

16

3. How to make Header File?

15. I added two button for test call JNI,

For use method in librarymake object typeof library Classand call object.method();

3.1) Let’s learn from Build Example Project

Page 17: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

17

3. How to make Header File?

16.When Click each button,Native Method is Called Successfully !

3.1) Let’s learn from Build Example Project

Page 18: 제 4회 DGMIT R&D 컨퍼런스 : Android NDK

18