SlideShare una empresa de Scribd logo
1 de 24
Android NDK Intoduction
Rahul Tripathi
Agenda
 The Android Native Development Kit (NDK)
 NDK Info
 What , Why , Why not ?
 Requirement Tools & Installation of NDK
 Developing an ADD application that uses the NDK
 Final Output
NDK info Android Native Development Kit (Android NDK)
Developer(s) - Google
Initial release - June 2009; 5 years ago
Stable release -
10d / December 2014; 2 months ago
Written in- C and C++
Operating system- Cross-platform
Available in- English
Type- IDE, SDK
Website-
developer.android.com/tools/sdk/ndk/index.ht
ml
Native Development Kit
What , Why ,Why Not?
 The NDK is a toolset that allows you to implement parts of your app
using native-code languages such as C and C++.
What is it?
Build scripts/toolkit to incorporate native code in Android * apps via the
Java Native
Interface (JNI)
Why use it?
Performance
e.g., complex algorithms, multimedia applications, games
Why not use it?
Performance improvement isn’t always
guaranteed, in contrary to the added
complexity
NDK Build Process
1. 3.
2.
Dalvik Application
Android NDK Application
What is JNI ?
 Android is put together of about equal part Java and C.
 we need an easy way to bridge between these two totally
different worlds.
 Java offers Java Native Interface (JNI) as a framework
connecting the world of Java to the native code.
NDK - System and Software Requirements
The Android SDK
 A complete Android SDK installation (including all dependencies) is required.
 Android 1.5 SDK or later version is required.
Supported operating systems
 Windows XP (32-bit) or Vista (32- or 64-bit)
 Mac OS X 10.4.8 or later (x86 only)
 Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions)
Required development tools
 For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU
Make might work but have not been tested.
 A recent version of awk (either GNU Awk or Nawk) is also required.
 For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5
installations.
How to Install NDK
On Linux and Mac OS X (Darwin):
 Download the appropriate package from this page.
 Open a terminal window.
 Go to the directory to which you downloaded the package.
 Run chmod a+x on the downloaded package.
 Execute the package. For example:
ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
ndk$ ./android-ndk-r10c-darwin-x86_64.bin
 The folder containing the NDK extracts itself.
 Note that you can also use a program like 7z to extract the package.
On Windows:
 Download the appropriate package from this page.
 Navigate to the folder to which you downloaded the package.
 Double-click the downloaded file. The folder containing the NDK extracts itself.
Configure NDK
Now Open Eclipse and Configure NDK .
Go to window Option on the top.
Click Preference :
In Android ----> Select NDK ----> Give the path of your
NDK Which you have Extracted by Terminal .
(Note : Please Don't Make any Space in Contains Path Folder)
You have to download For NDK ..
Click Help : Install New Software ----> Select Release / Juno Link ..
Now Select
 C/C++ GCC Cross Compiler Support
 C/C++ GDB Hardware Debugging
Now Finish ....
Now Start With Project
Create a Android Application Project -->
Right Click on project -->
Select Android tool -->
Add Native Support -->
NDK Project Explorer in Eclipse
Jni Folder
C/C++ File
Android.mk file
Application.mk file
After do that, your project has a folder called “jni”. Inside this folder, you have the
Android.mk file, which goes your library configuration for the compiler. And there is a
another file with .cpp (C++) extension, this is where your native code goes.You have to
create A file in side jni folder Application.mk which describe which native 'modules' (i.e.
static/shared libraries) are needed by your application.
Now Here is .Java , .MK
Android.MK & Application.MK
 Android.mk :- sub-makefile that describes the C++
static libraries and *.so files you want to build.
 Application.mk :- contains settings that apply to
all the C/C++ code (processor type, API level,
standard library, project-wide compiler options)
Calling Native From Java
• Create an activity .JAVA .
• Write A native method in side that Activity .
• JNI program uses a static initializer to load a shared library
("myjni.dll" in Windows or "libmyjni.so" in Ubuntu). It
declares a native method.
Create A JNI .h Header File Using "Javah"
Generating C/C++ Header File using "javah" Utility
 Now We Have to Create Header File (.h) under JNI Folder .
Using Terminal/Cygwin
 Go to your bin directory using cd command .. On Terminal/Cygwin .
No.....
You Can Create Manual Javah Builder ...
Header file for C/C++ Programs
 Run javah utility on the class file to create a header file for C/C++ programs.
C/C++ Implementation
Write Your C/C++ Code
JNI environment interface function
What is Javah ?
 Java is bundled with JDK .it Has command to generate c header file from a
java class. this file provide connective glue that allow your java and c code to
intract.
How to find your Javah from Terminal :
Which Javah
Setting up Automatic NDK Builds in
Eclipse
 Start by right clicking on your android project and select Properties. In the resulting
dialog, choose the Builders entry in the list to the left and press the New... button:
Here We Go .......... NDK Build

NDK Build Finish ....
Generated
Shared Library .So File
1. The Android OS loads the Java code and starts
executing it
2. The Java code calls System.loadLibrary() to load
a native library.
3. The Java code starts calling functions from the
native code.
Final Output
Thank You

Más contenido relacionado

La actualidad más candente

NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in AndroidArvind Devaraj
 
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)DroidConTLV
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Paris Android User Group
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineChun-Yu Wang
 
Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0André Moreira
 
Android Developer Meetup
Android Developer MeetupAndroid Developer Meetup
Android Developer MeetupMedialets
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen Chen
 
Hierarchy Viewer Internals
Hierarchy Viewer InternalsHierarchy Viewer Internals
Hierarchy Viewer InternalsKyungmin Lee
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolGabor Paller
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAlex Matrosov
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applicationshubx
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - IntroductionRakesh Jha
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Farshid Pirahansiah
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Tetsuyuki Kobayashi
 
Google ART (Android RunTime)
Google ART (Android RunTime)Google ART (Android RunTime)
Google ART (Android RunTime)Niraj Solanke
 

La actualidad más candente (20)

NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in Android
 
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)
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
 
Android NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo NativoAndroid NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo Nativo
 
PIC your malware
PIC your malwarePIC your malware
PIC your malware
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0Guide: How to Build OpenCV 3.0.0
Guide: How to Build OpenCV 3.0.0
 
Android Developer Meetup
Android Developer MeetupAndroid Developer Meetup
Android Developer Meetup
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-level
 
Hierarchy Viewer Internals
Hierarchy Viewer InternalsHierarchy Viewer Internals
Hierarchy Viewer Internals
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer tool
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/Gapz
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - Introduction
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'
 
Google ART (Android RunTime)
Google ART (Android RunTime)Google ART (Android RunTime)
Google ART (Android RunTime)
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
How to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDKHow to Build & Use OpenCL on OpenCV & Android NDK
How to Build & Use OpenCL on OpenCV & Android NDK
 

Destacado

Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編OESF Education
 
Confidentiality of Information
Confidentiality of InformationConfidentiality of Information
Confidentiality of Informationrrevels57
 
Planning
PlanningPlanning
Planning957755
 
Avdert feedback new
Avdert feedback newAvdert feedback new
Avdert feedback new957755
 
Music video pitch
Music video pitchMusic video pitch
Music video pitch957755
 
Michael jackson ‘beat it’.pptx
Michael jackson ‘beat it’.pptxMichael jackson ‘beat it’.pptx
Michael jackson ‘beat it’.pptx957755
 
Namiin jagsaalt 2012
Namiin jagsaalt 2012Namiin jagsaalt 2012
Namiin jagsaalt 2012GEC Mongolia
 
In what ways does your media product use conventions
In what ways does your media product use conventionsIn what ways does your media product use conventions
In what ways does your media product use conventions957755
 
The muppets’ marketing campaign
The muppets’ marketing campaignThe muppets’ marketing campaign
The muppets’ marketing campaign957755
 
Making the advert
Making the advertMaking the advert
Making the advert957755
 
Organisation of costume and props
Organisation of costume and propsOrganisation of costume and props
Organisation of costume and props957755
 
Audience feedback on the digipack
Audience feedback on the digipack Audience feedback on the digipack
Audience feedback on the digipack 957755
 

Destacado (20)

Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編
 
Confidentiality of Information
Confidentiality of InformationConfidentiality of Information
Confidentiality of Information
 
Best places in London to visit
Best places in London to visit Best places in London to visit
Best places in London to visit
 
Planning
PlanningPlanning
Planning
 
SVN Information
SVN Information  SVN Information
SVN Information
 
მასწ ინგლისურის ტესტი 2016
მასწ ინგლისურის ტესტი 2016მასწ ინგლისურის ტესტი 2016
მასწ ინგლისურის ტესტი 2016
 
Avdert feedback new
Avdert feedback newAvdert feedback new
Avdert feedback new
 
Music video pitch
Music video pitchMusic video pitch
Music video pitch
 
Leveraging social media 2016 final
Leveraging social media 2016 finalLeveraging social media 2016 final
Leveraging social media 2016 final
 
Michael jackson ‘beat it’.pptx
Michael jackson ‘beat it’.pptxMichael jackson ‘beat it’.pptx
Michael jackson ‘beat it’.pptx
 
Namiin jagsaalt 2012
Namiin jagsaalt 2012Namiin jagsaalt 2012
Namiin jagsaalt 2012
 
მასწ ინგლისურის ტესტი 2011
მასწ ინგლისურის ტესტი 2011მასწ ინგლისურის ტესტი 2011
მასწ ინგლისურის ტესტი 2011
 
Angello intro
Angello introAngello intro
Angello intro
 
In what ways does your media product use conventions
In what ways does your media product use conventionsIn what ways does your media product use conventions
In what ways does your media product use conventions
 
The muppets’ marketing campaign
The muppets’ marketing campaignThe muppets’ marketing campaign
The muppets’ marketing campaign
 
Making the advert
Making the advertMaking the advert
Making the advert
 
Organisation of costume and props
Organisation of costume and propsOrganisation of costume and props
Organisation of costume and props
 
Audience feedback on the digipack
Audience feedback on the digipack Audience feedback on the digipack
Audience feedback on the digipack
 
Mi presentacion
Mi presentacionMi presentacion
Mi presentacion
 
მასწ ინგლისურის ტესტი 2012
მასწ ინგლისურის ტესტი 2012მასწ ინგლისურის ტესტი 2012
მასწ ინგლისურის ტესტი 2012
 

Similar a NDK Introduction

Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application DevelopmentArief Gunawan
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows DevelopersYoss Cohen
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocksTech Bikram
 
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdkTran Le Hoan
 
제 4회 DGMIT R&D 컨퍼런스 : Android NDK
제 4회 DGMIT R&D 컨퍼런스 : Android NDK제 4회 DGMIT R&D 컨퍼런스 : Android NDK
제 4회 DGMIT R&D 컨퍼런스 : Android NDKdgmit2009
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setuppbeerak
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android developmentGhufran Hashmi
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 
Android Application Development Environment Setup
Android Application Development Environment SetupAndroid Application Development Environment Setup
Android Application Development Environment SetupIan Pinto
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 

Similar a NDK Introduction (20)

Android ndk
Android ndkAndroid ndk
Android ndk
 
Android App development I
Android App development IAndroid App development I
Android App development I
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application Development
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Android app upload
Android app uploadAndroid app upload
Android app upload
 
AndEngine
AndEngineAndEngine
AndEngine
 
How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdk
 
제 4회 DGMIT R&D 컨퍼런스 : Android NDK
제 4회 DGMIT R&D 컨퍼런스 : Android NDK제 4회 DGMIT R&D 컨퍼런스 : Android NDK
제 4회 DGMIT R&D 컨퍼런스 : Android NDK
 
Android session 1
Android session 1Android session 1
Android session 1
 
Android studio
Android studioAndroid studio
Android studio
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setup
 
Android Basic
Android BasicAndroid Basic
Android Basic
 
Android
Android Android
Android
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android development
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Android Application Development Environment Setup
Android Application Development Environment SetupAndroid Application Development Environment Setup
Android Application Development Environment Setup
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 

Último

FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Servicenishacall1
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfCWS Technology
 

Último (6)

FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 

NDK Introduction

  • 2. Agenda  The Android Native Development Kit (NDK)  NDK Info  What , Why , Why not ?  Requirement Tools & Installation of NDK  Developing an ADD application that uses the NDK  Final Output
  • 3. NDK info Android Native Development Kit (Android NDK) Developer(s) - Google Initial release - June 2009; 5 years ago Stable release - 10d / December 2014; 2 months ago Written in- C and C++ Operating system- Cross-platform Available in- English Type- IDE, SDK Website- developer.android.com/tools/sdk/ndk/index.ht ml
  • 4. Native Development Kit What , Why ,Why Not?  The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++. What is it? Build scripts/toolkit to incorporate native code in Android * apps via the Java Native Interface (JNI) Why use it? Performance e.g., complex algorithms, multimedia applications, games Why not use it? Performance improvement isn’t always guaranteed, in contrary to the added complexity
  • 5. NDK Build Process 1. 3. 2. Dalvik Application Android NDK Application
  • 6. What is JNI ?  Android is put together of about equal part Java and C.  we need an easy way to bridge between these two totally different worlds.  Java offers Java Native Interface (JNI) as a framework connecting the world of Java to the native code.
  • 7. NDK - System and Software Requirements The Android SDK  A complete Android SDK installation (including all dependencies) is required.  Android 1.5 SDK or later version is required. Supported operating systems  Windows XP (32-bit) or Vista (32- or 64-bit)  Mac OS X 10.4.8 or later (x86 only)  Linux (32 or 64-bit; Ubuntu 8.04, or other Linux distributions) Required development tools  For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.  A recent version of awk (either GNU Awk or Nawk) is also required.  For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.
  • 8. How to Install NDK On Linux and Mac OS X (Darwin):  Download the appropriate package from this page.  Open a terminal window.  Go to the directory to which you downloaded the package.  Run chmod a+x on the downloaded package.  Execute the package. For example: ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin ndk$ ./android-ndk-r10c-darwin-x86_64.bin  The folder containing the NDK extracts itself.  Note that you can also use a program like 7z to extract the package. On Windows:  Download the appropriate package from this page.  Navigate to the folder to which you downloaded the package.  Double-click the downloaded file. The folder containing the NDK extracts itself.
  • 9. Configure NDK Now Open Eclipse and Configure NDK . Go to window Option on the top. Click Preference : In Android ----> Select NDK ----> Give the path of your NDK Which you have Extracted by Terminal . (Note : Please Don't Make any Space in Contains Path Folder) You have to download For NDK .. Click Help : Install New Software ----> Select Release / Juno Link .. Now Select  C/C++ GCC Cross Compiler Support  C/C++ GDB Hardware Debugging Now Finish ....
  • 10. Now Start With Project Create a Android Application Project --> Right Click on project --> Select Android tool --> Add Native Support -->
  • 11. NDK Project Explorer in Eclipse Jni Folder C/C++ File Android.mk file Application.mk file After do that, your project has a folder called “jni”. Inside this folder, you have the Android.mk file, which goes your library configuration for the compiler. And there is a another file with .cpp (C++) extension, this is where your native code goes.You have to create A file in side jni folder Application.mk which describe which native 'modules' (i.e. static/shared libraries) are needed by your application.
  • 12. Now Here is .Java , .MK
  • 13. Android.MK & Application.MK  Android.mk :- sub-makefile that describes the C++ static libraries and *.so files you want to build.  Application.mk :- contains settings that apply to all the C/C++ code (processor type, API level, standard library, project-wide compiler options)
  • 14. Calling Native From Java • Create an activity .JAVA . • Write A native method in side that Activity . • JNI program uses a static initializer to load a shared library ("myjni.dll" in Windows or "libmyjni.so" in Ubuntu). It declares a native method.
  • 15. Create A JNI .h Header File Using "Javah" Generating C/C++ Header File using "javah" Utility  Now We Have to Create Header File (.h) under JNI Folder . Using Terminal/Cygwin  Go to your bin directory using cd command .. On Terminal/Cygwin . No..... You Can Create Manual Javah Builder ...
  • 16. Header file for C/C++ Programs  Run javah utility on the class file to create a header file for C/C++ programs.
  • 17. C/C++ Implementation Write Your C/C++ Code JNI environment interface function
  • 18. What is Javah ?  Java is bundled with JDK .it Has command to generate c header file from a java class. this file provide connective glue that allow your java and c code to intract. How to find your Javah from Terminal : Which Javah
  • 19. Setting up Automatic NDK Builds in Eclipse  Start by right clicking on your android project and select Properties. In the resulting dialog, choose the Builders entry in the list to the left and press the New... button:
  • 20. Here We Go .......... NDK Build 
  • 22. Generated Shared Library .So File 1. The Android OS loads the Java code and starts executing it 2. The Java code calls System.loadLibrary() to load a native library. 3. The Java code starts calling functions from the native code.