SlideShare a Scribd company logo
Native Android
for
Windows Developers

Yossi Cohen
INSTALLATIONS

Install Eclipse + CDT
Install SDK
Install ADT
Install USB Driver
Install NDK
Install Cygwin ….
Eclipse Installation
• Download & Install Eclipse
  ▫ Select the classic version from
    http://www.eclipse.org/downloads/
  ▫ CDT for C/C++ development is recommended
       Select “Install New Software” from Eclipse’ Help menu
      Select available software sites
      Check CDT
      Install CDT components
SDK Installation
• Download & Install SDK (select windows option)
  ▫ http://developer.android.com/sdk/index.html
• Install the ADT (Android Developer Tools) for Eclipse
  ▫ Instructions:
  ▫ http://developer.android.com/sdk/eclipse-adt.html#installing
  ▫ Press Add in available software menu




  ▫ Add ADT with the link below



                                                                   4
USB Driver / NDK Installations
• Install USB Driver
 ▫ If you don’t have a nexus phone download driver
   from vendor. Instructions:
   http://developer.android.com/sdk/oem-usb.html#InstallingDriver
• Install NDK
 ▫ http://developer.android.com/sdk/ndk/index.html

• Preferably do all Installations in D:Android




                                                                    5
Cygwin Installation
•   Goo to http://cygwin.com/ and download setup
•   Install Cygwin.
•   Select default install options
•   After installation, add the following Dirs to
    Cygwin Path:
    ▫ C:Androidandroid-sdktools
    ▫ C:Androidandroid-ndk-r7buildtools




                                                    6
THE FIRST NDK SAMPLE
Running a native sample app
• In Eclipse, Select:
  ▫ File->New->Project->Android
    Project
• Select “Create Project From
  Existing Source”
• change the directory to the
  Installed NDK samples:
• D:Androidandroid-ndk-
  r7samplesHello-Jni
• Select target and finish
Compile & Run
• Compile the Java application
• Run it on your phone target
• Crash?
• Open Cygwin window
• Compile the native code in:
  D:Androidandroid-ndk-r7samplesHello-Jni
  JNI using ndk-build command
• Compile the Java application
• Run it on your target



                                                 9
CODE REVIEW




              10
Java Code Review
• Java part of the application is simple:




• On create, the application prints to the screen a
  string it receives from stringFromJNI() declared
  as a Native function
• Native library hello-jni is loaded
                                                      11
Java to C calling convention
/* sample method where the Java call passed no parameters */
void Java_ClassName_MethodName (JNIEnv *env, jobject obj)
{/* do something */ }
/* another sample method with two parameters passed, returning
a double */
jdouble Java_ClassName_MethodName ( JNIEnv* env, jobject obj,
   jdouble x, jdouble y)
{ return x + y; }
• Note: Android Java identifies the native functions according to their
   C type signature. If the call is for CPP functions, the Java program
   will not recognize them. The solution to this problem is to use
   extern “C” { } around the CPP functions
Make Files
• Android native applications must could have two
  make files:
 ▫ Android.mk – details the source header and
   libraries used to create the application (library)
 ▫ Application.mk – details the target platform,
   processor (ARM 7) and API level (API 10). The
   application.mk file is not mandatory
Android.mk Sample
Example, the HelloJNI NDK sample make File

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c

include $(BUILD_SHARED_LIBRARY)
Android.mk Review
• LOCAL_PATH := $(call my-dir)
 ▫ first understand where we are since include paths
   are usually RELATIVE to our current location.
   This must be the first command in the mk file
• CLEAR_VARS - clears special GNU Makefile
  LOCAL_XXX variables like LOCAL_SRC_FILES
• LOCAL_MODULE := hello-jni
  The LOCAL_MODULE variable must be defined
  to identify each module you describe in your
  Android.mk. The name must be *unique*
  without spaces.
Application.mk Review
• The hello-jni sample does not include
  application.mk file.
• Application.mk can define the target platform as
  9 (Android 2.2)                APP_PLATFORM := android-9


• Application file can also define the processor
  version:
# Build both ARMv5TE and ARMv7-A machine code.
APP_ABI := armeabi armeabi-v7a
Refrences
• Review of Android Make file
• Native android development
• Cygwin Install for Android
DSP-IP Contact information
For courses & programming services contact

Yossi Cohen
yossi@dsp-ip.com
+972-545-313092

More Related Content

PDF
NDK Programming in Android
PDF
Introduction to the Android NDK
PDF
TDC2016POA | Trilha Cloud Computing - Source-to-image - How to transform any ...
PPTX
Continuous integration by Rémy Virin
PDF
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
PDF
LLVM Internal Architecture par Michel Guillet
PDF
Testing - Selenium? Rich-Clients? Containers?
PDF
Deliver Python Apps with Docker
NDK Programming in Android
Introduction to the Android NDK
TDC2016POA | Trilha Cloud Computing - Source-to-image - How to transform any ...
Continuous integration by Rémy Virin
ネイティブAndroidエンジニアがVueNativeでiOSアプリを作ってみた
LLVM Internal Architecture par Michel Guillet
Testing - Selenium? Rich-Clients? Containers?
Deliver Python Apps with Docker

What's hot (19)

PPT
Continuos integration for iOS projects
PDF
Accessors Vs Direct access to properties & Design Pattern
PDF
2013 10-28 php ug presentation - ci using phing and hudson
PPTX
20170321 docker with Visual Studio 2017
PDF
Deployment Automation with Docker
PDF
JCConf 2015 workshop 動手玩 Java 專案建置工具
PDF
Introduction to Eclipse Che - Devoxx FR - 2017
PDF
CI/CD with Docker on AWS
PDF
Eclipse Neon Webinar - Docker Tooling for Developers
PPTX
Drupal 8 configuration development flow
PDF
Docker Tooling for Java EE Developers
PDF
DOD 2016 - Sebastian Krzyszkowiak - Jenkins: The Pipeline
PDF
Docker SQL Continuous Integration Flow
PPTX
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
PDF
Docker multi-stage build
PDF
OpenShift Build Pipelines @ Lightweight Java User Group Meetup
PDF
OOP2017: Containerized End-2-End Testing – automate it!
PDF
Jenkins Pipeline meets Oracle
Continuos integration for iOS projects
Accessors Vs Direct access to properties & Design Pattern
2013 10-28 php ug presentation - ci using phing and hudson
20170321 docker with Visual Studio 2017
Deployment Automation with Docker
JCConf 2015 workshop 動手玩 Java 專案建置工具
Introduction to Eclipse Che - Devoxx FR - 2017
CI/CD with Docker on AWS
Eclipse Neon Webinar - Docker Tooling for Developers
Drupal 8 configuration development flow
Docker Tooling for Java EE Developers
DOD 2016 - Sebastian Krzyszkowiak - Jenkins: The Pipeline
Docker SQL Continuous Integration Flow
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Docker multi-stage build
OpenShift Build Pipelines @ Lightweight Java User Group Meetup
OOP2017: Containerized End-2-End Testing – automate it!
Jenkins Pipeline meets Oracle
Ad

Similar to Native Android for Windows Developers (20)

PPTX
PPTX
PPTX
Android ndk - Introduction
PPTX
Native development kit (ndk) introduction
PDF
Working with the AOSP - Linaro Connect Asia 2013
PPTX
Rhodes mobile Framework
PPTX
Using the android ndk - DroidCon Paris 2014
PPTX
Getting started with the NDK
PPTX
NDK Introduction
PDF
Android programming-basics
PPTX
PDF
DLL Design with Building Blocks
PDF
Using the Android Native Development Kit (NDK)
PPTX
Mobile app with cordova
PPTX
Mobile app with cordova
PDF
[CCDD2013w] Coming to grips with deving for android by 蔡亦恒
PPTX
DOC
Video optimization for android - Part I
PPTX
Introduction of phonegap installation and configuration of Phonegap with An...
PPTX
React native on windows
Android ndk - Introduction
Native development kit (ndk) introduction
Working with the AOSP - Linaro Connect Asia 2013
Rhodes mobile Framework
Using the android ndk - DroidCon Paris 2014
Getting started with the NDK
NDK Introduction
Android programming-basics
DLL Design with Building Blocks
Using the Android Native Development Kit (NDK)
Mobile app with cordova
Mobile app with cordova
[CCDD2013w] Coming to grips with deving for android by 蔡亦恒
Video optimization for android - Part I
Introduction of phonegap installation and configuration of Phonegap with An...
React native on windows
Ad

More from Yoss Cohen (20)

PPTX
Underwater robotics simulation with isaac sim
PPTX
Infrared simulation and processing on Nvidia platforms
PPTX
open platform for swarm training
PDF
Deep Learning - system view
PDF
Dspip deep learning syllabus
PPT
IoT consideration selection
PPT
IoT evolution
DOC
Nvidia jetson nano bringup
PPT
Autonomous car teleportation architecture
PPT
Motion estimation overview
PPT
Computer Vision - Image Filters
PPT
Intro to machine learning with scikit learn
PPT
DASH and HTTP2.0
PPT
HEVC Definitions and high-level syntax
PPT
Introduction to HEVC
PPT
FFMPEG on android
PDF
Hands-on Video Course - "RAW Video"
PDF
Video quality testing
PPT
HEVC / H265 Hands-On course
PPT
Web video standards
Underwater robotics simulation with isaac sim
Infrared simulation and processing on Nvidia platforms
open platform for swarm training
Deep Learning - system view
Dspip deep learning syllabus
IoT consideration selection
IoT evolution
Nvidia jetson nano bringup
Autonomous car teleportation architecture
Motion estimation overview
Computer Vision - Image Filters
Intro to machine learning with scikit learn
DASH and HTTP2.0
HEVC Definitions and high-level syntax
Introduction to HEVC
FFMPEG on android
Hands-on Video Course - "RAW Video"
Video quality testing
HEVC / H265 Hands-On course
Web video standards

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
KodekX | Application Modernization Development
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Monthly Chronicles - July 2025
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Electronic commerce courselecture one. Pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
MYSQL Presentation for SQL database connectivity
CIFDAQ's Market Insight: SEC Turns Pro Crypto
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing

Native Android for Windows Developers

  • 2. INSTALLATIONS Install Eclipse + CDT Install SDK Install ADT Install USB Driver Install NDK Install Cygwin ….
  • 3. Eclipse Installation • Download & Install Eclipse ▫ Select the classic version from http://www.eclipse.org/downloads/ ▫ CDT for C/C++ development is recommended  Select “Install New Software” from Eclipse’ Help menu  Select available software sites  Check CDT  Install CDT components
  • 4. SDK Installation • Download & Install SDK (select windows option) ▫ http://developer.android.com/sdk/index.html • Install the ADT (Android Developer Tools) for Eclipse ▫ Instructions: ▫ http://developer.android.com/sdk/eclipse-adt.html#installing ▫ Press Add in available software menu ▫ Add ADT with the link below 4
  • 5. USB Driver / NDK Installations • Install USB Driver ▫ If you don’t have a nexus phone download driver from vendor. Instructions: http://developer.android.com/sdk/oem-usb.html#InstallingDriver • Install NDK ▫ http://developer.android.com/sdk/ndk/index.html • Preferably do all Installations in D:Android 5
  • 6. Cygwin Installation • Goo to http://cygwin.com/ and download setup • Install Cygwin. • Select default install options • After installation, add the following Dirs to Cygwin Path: ▫ C:Androidandroid-sdktools ▫ C:Androidandroid-ndk-r7buildtools 6
  • 7. THE FIRST NDK SAMPLE
  • 8. Running a native sample app • In Eclipse, Select: ▫ File->New->Project->Android Project • Select “Create Project From Existing Source” • change the directory to the Installed NDK samples: • D:Androidandroid-ndk- r7samplesHello-Jni • Select target and finish
  • 9. Compile & Run • Compile the Java application • Run it on your phone target • Crash? • Open Cygwin window • Compile the native code in: D:Androidandroid-ndk-r7samplesHello-Jni JNI using ndk-build command • Compile the Java application • Run it on your target 9
  • 11. Java Code Review • Java part of the application is simple: • On create, the application prints to the screen a string it receives from stringFromJNI() declared as a Native function • Native library hello-jni is loaded 11
  • 12. Java to C calling convention /* sample method where the Java call passed no parameters */ void Java_ClassName_MethodName (JNIEnv *env, jobject obj) {/* do something */ } /* another sample method with two parameters passed, returning a double */ jdouble Java_ClassName_MethodName ( JNIEnv* env, jobject obj, jdouble x, jdouble y) { return x + y; } • Note: Android Java identifies the native functions according to their C type signature. If the call is for CPP functions, the Java program will not recognize them. The solution to this problem is to use extern “C” { } around the CPP functions
  • 13. Make Files • Android native applications must could have two make files: ▫ Android.mk – details the source header and libraries used to create the application (library) ▫ Application.mk – details the target platform, processor (ARM 7) and API level (API 10). The application.mk file is not mandatory
  • 14. Android.mk Sample Example, the HelloJNI NDK sample make File LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := hello-jni LOCAL_SRC_FILES := hello-jni.c include $(BUILD_SHARED_LIBRARY)
  • 15. Android.mk Review • LOCAL_PATH := $(call my-dir) ▫ first understand where we are since include paths are usually RELATIVE to our current location. This must be the first command in the mk file • CLEAR_VARS - clears special GNU Makefile LOCAL_XXX variables like LOCAL_SRC_FILES • LOCAL_MODULE := hello-jni The LOCAL_MODULE variable must be defined to identify each module you describe in your Android.mk. The name must be *unique* without spaces.
  • 16. Application.mk Review • The hello-jni sample does not include application.mk file. • Application.mk can define the target platform as 9 (Android 2.2) APP_PLATFORM := android-9 • Application file can also define the processor version: # Build both ARMv5TE and ARMv7-A machine code. APP_ABI := armeabi armeabi-v7a
  • 17. Refrences • Review of Android Make file • Native android development • Cygwin Install for Android
  • 18. DSP-IP Contact information For courses & programming services contact Yossi Cohen yossi@dsp-ip.com +972-545-313092