SlideShare una empresa de Scribd logo
1 de 46
Descargar para leer sin conexión
Desenvolvendo Apps
Nativas com NDK
Eduardo Carrara de Araujo
Software Analyst – Intel Software
Agenda
•
•
•
•
•
•

Entendendo o mundo Android* Nativo
Conhecendo suas ferramentas
Preparando-se para a batalha
Mãos à obra!
Quebrou! E agora?
Q&A

2
Entendendo o mundo
Android* Nativo

INTEL CONFIDENTIAL
Apps

Home

Application
Framework

User
Experience

Apps

As Engrenagens do Robô
Contacts

Phone

Browser

Activity Manager

Windows*
Manager

Content Providers

View System

Package Manager

Telephony
Manager

Resource
Manager

Location Manager

Libraries

…

Notification Manager

Android* Runtime

Surface Manager

Media
Framework

SQLite

OpenGL* ES

FreeType

WebKit

SGL

Middleware

…

SSL

libc

Core Libraries

Dalvik Virtual Machine

…

Operating
System

Linux* Kernel

4

Display Driver

Camera Driver

Flash Memory
Driver

Binder (IPC) Driver

Keypad Driver

WiFi Driver

Audio Drivers

Power Management
Nativo VS. Dalvik*
• O que é uma aplicação
Android* nativa?
• O que a Intel já faz
por você?

Android Runtime
Dalvik Virtual
Machine
Core Libraries

5
Por quê utilizar código nativo?
Performance
Jogos
Processamento Gráfico
Criptografia
Algoritmos de baixo nível
Acesso direto à CPU, GPU e outros recursos de
HW
• Reuso de código
• E por que não utilizar?
•
•
•
•
•
•

• Performance
• Complexidade

6
Conhecendo suas
ferramentas

7

INTEL CONFIDENTIAL
Android* Native Development Kit (NDK)

• O que é?
• Conjunto de ferramentas que permitem a implementação
de partes da aplicação Android utilizando código nativo
em linguagens como C ou C++.
• A interação entre o código nativo e a app Android é feita
utilizando Java Native Interface (JNI).
Java Native Interface (JNI)
• O que é?
• Interface padrão de programação para interoperabilidade entre
bibliotecas nativas de uma plataforma e a máquina virtual
Java.

• Quando usar?
• Acessar funcionalidades dependentes de plataforma não
providas pela API padrão do Java.
• Re-uso de código.
• Porções de código que precisam de tuning de performance.

9
Fluxo de Desenvolvimento com NDK
C/C++
Code

ndkbuild

Makefile

Java*
calls

GDB
debug

JNI

APP_ABI := all
or APP_ABI := x86

Android* ApplicationsJava Application
SDK APIs
Java Framework

JNI

Native Libs
Bionic C Library
10

NDK APIs
Conheça os limites: A Bionic C
• Biblioteca C otimizada para a plataforma
Android.
• Mais leve que a GNU C.
• Não segue o padrão POSIX.
• Suporte limitado à pthreads.
• Acesso às propriedades do Android

12
Preparando-se para a
batalha

14

INTEL CONFIDENTIAL
Instalando o Android* NDK
• Baixe o SDK:
http://developer.android.com/too
ls/sdk/ndk
• Baixe o Intel Beacon Mountain:
http://software.intel.com/enus/vcsource/tools/beaconmountai
n

• Integre com o ADT e o
CDT no Eclipse*
Adicionando Suporte Nativo (Eclipse*)

16
Sem o piloto automático
Standard Android* Project Structure

1. Create JNI folder for
native sources

Native Sources - JNI Folder
2. Reuse or create native c/c++
sources

3. Create Android.mk
Makefile

NDK-BUILD will automatically
create ABI libs folders.

4. Build Native libraries using NDKBUILD script.

17
Mãos à obra!

INTEL CONFIDENTIAL
Hello NDK!
• Agora que temos um projeto pronto para
utilizar código nativo. Qual o próximo
passo?
• Como integrar o código Java com o C++?

19
Integrando Funções Nativas com Java
• Declarar métodos nativos em Java:
• public native String getHelloMessage();

• A aplicação Java deve carregar a biblioteca
antes de utilizá-la:
• System.loadLibrary("HelloNDK");

• Implementar em sua biblioteca nativa os
métodos a serem utilizados pela aplicação
• Os pontos de entrada da biblioteca podem ser criados de duas
formas: com a ferramenta Javah ou as registrando na função
JNI_onLoad na biblioteca.

20
Javah
• Gera os “header stubs” apropriados para
JNI à partir das classes Java já compiladas.
• Example:
> javah –d jni –classpath bin/classes 
com.example.hellojni.HelloJni

• Gera o arquivo: com_example_hellojni_HelloJni.h
• Com a definição: JNIEXPORT jstring JNICALL
Java_com_example_hellojni_HelloJni_stringFromJNI(JN
IEnv *, jobject);

21
Javah

...
{
...
tv.setText( stringFromJNI() );
...
}
public native String

stringFromJNI();

static {
System.loadLibrary("hello-jni");
}

jstring
Java_com_example_hellojni_HelloJni_stringFromJNI(JNIEnv*
env,
jobject thiz )
{
return (*env)->NewStringUTF(env, "Hello from JNI !");
}
JNI_onLoad
• Registro das funções JNI no carregamento
da biblioteca.
• Utilizado nos módulos nativos do AOSP.

• Sujeito a menos erros durante refatoração.
• Melhor local para lidar com o caching de

referências à objetos Java.

23
JNI_onLoad
• Declare a função C++ em sua lib:
jstring stringFromJNI(JNIEnv* env, jobject thiz)
{
return env->NewStringUTF("Hello from JNI !");
}

• Crie o mapeamento de funções expostas:
static JNINativeMethod exposedMethods[] = {
{"stringFromJNI","()Ljava/lang/String;",(void*)stringFromJNI},}

• Utilize a ferramenta javap para obter a assinatura dos
métodos nativos:
javap -s -classpath binclasses -p com.example.hellojni.HelloJni
-> Signature: ()Ljava/lang/String;

24
JNI_onLoad
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) !=
JNI_OK)
return JNI_ERR;
jclass clazz = env>FindClass("com/intel/applab/nativesample/NativeSample");
if(clazz==NULL)
return JNI_ERR;
env->RegisterNatives(clazz, exposedMethods,
sizeof(exposedMethods)/sizeof(JNINativeMethod));
env->DeleteLocalRef(clazz);
return JNI_VERSION_1_6;
}

25
Estamos prontos? Não!
• Utilizar o arquivo Application.mk para descrever
sua app:
•
•
•
•

Diretório: jni
Descrever os módulos necessários
Arquiteturas suportadas: ABI
Arquivo opcional mas importante para garantir que seus
módulos nativos sejam compilados para diversas plataformas.

APP_ABI := armeabi armeabi-v7a x86
Ou
APP_ABI := all

26
Build it!
• Utilizando Eclipse*
• Com a integração ADT e NDK no Eclipse* basta compilar a app
para gerar as bibliotecas e empacotar seu apk.

• Hardcore Mode
• Utilizar o script ndk_build para gerar os módulos.
• No diretório raíz de sua app execute:
• $NDK/ndk_build

27
Quebrou! E agora?

INTEL CONFIDENTIAL
LogCat
• Mecanismo básico de logs do Android. No NDK pode
ser acessado pela API: <android/log.h>
• int __android_log_print(int prio, const char *tag,
const char *fmt, ...)

• Normalmente utilizado com a macro:
• #define LOGI(...)
((void)__android_log_print(ANDROID_LOG_INFO,
"APPTAG", __VA_ARGS__))

• Exemplo
• LOGI("accelerometer: x=%f y=%f z=%f", x, y, z);

29
Q&A

31

INTEL CONFIDENTIAL
Legal Disclaimer
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO
ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH
PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF
INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY
PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD
YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES,
SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND
EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH
ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN,
MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any
features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or
incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published
specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or
go to: http://www.intel.com/design/literature.htm
Silvermont and other code names featured are used internally within Intel to identify products that are in development and not yet publicly announced for
release. Customers, licensees and other third parties are not authorized by Intel to use code names in advertising, promotion or marketing of any product or
services and any such use of Intel's internal code names is at the sole risk of the user.
Intel, Atom, Look Inside and the Intel logo are trademarks of Intel Corporation in the United States and other countries.
*Other names and brands may be claimed as the property of others.
Copyright ©2013 Intel Corporation.

32
Legal Disclaimer
• Roadmap Notice: All products, computer systems, dates and figures specified are preliminary based on current
expectations, and are subject to change without notice.
• Intel® Virtualization Technology (Intel® VT) requires a computer system with an enabled Intel® processor, BIOS, and
virtual machine monitor (VMM). Functionality, performance or other benefits will vary depending on hardware and
software configurations. Software applications may not be compatible with all operating systems. Consult your PC
manufacturer. For more information, visit http://www.intel.com/go/virtualization.
• Software Source Code Disclaimer: Any software source code reprinted in this document is furnished under a software
license and may only be used or copied in accordance with the terms of that license.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

33
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for
optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3,
and SSE3 instruction sets and other optimizations. Intel does not guarantee the availability,
functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel.
Microprocessor-dependent optimizations in this product are intended for use with Intel
microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel
microprocessors. Please refer to the applicable product User and Reference Guides for more
information regarding the specific instruction sets covered by this notice.
Notice revision #20110804

34
Risk Factors
The above statements and any others in this document that refer to plans and expectations for the third quarter, the year and the future are forward-looking
statements that involve a number of risks and uncertainties. Words such as “anticipates,” “expects,” “intends,” “plans,” “believes,” “seeks,” “estimates,” “may,”
“will,” “should” and their variations identify forward-looking statements. Statements that refer to or are based on projections, uncertain events or assumptions
also identify forward-looking statements. Many factors could affect Intel’s actual results, and variances from Intel’s current expectations regarding such factors
could cause actual results to differ materially from those expressed in these forward-looking statements. Intel presently considers the following to be the
important factors that could cause actual results to differ materially from the company’s expectations. Demand could be different from Intel's expectations due to
factors including changes in business and economic conditions; customer acceptance of Intel’s and competitors’ products; supply constraints and other disruptions
affecting customers; changes in customer order patterns including order cancellations; and changes in the level of inventory at customers. Uncertainty in global
economic and financial conditions poses a risk that consumers and businesses may defer purchases in response to negative financial events, which could
negatively affect product demand and other related matters. Intel operates in intensely competitive industries that are characterized by a high percentage of
costs that are fixed or difficult to reduce in the short term and product demand that is highly variable and difficult to forecast. Revenue and the gross margin
percentage are affected by the timing of Intel product introductions and the demand for and market acceptance of Intel's products; actions taken by Intel's
competitors, including product offerings and introductions, marketing programs and pricing pressures and Intel’s response to such actions; and Intel’s ability to
respond quickly to technological developments and to incorporate new features into its products. The gross margin percentage could vary significantly from
expectations based on capacity utilization; variations in inventory valuation, including variations related to the timing of qualifying products for sale; changes in
revenue levels; segment product mix; the timing and execution of the manufacturing ramp and associated costs; start-up costs; excess or obsolete inventory;
changes in unit costs; defects or disruptions in the supply of materials or resources; product manufacturing quality/yields; and impairments of long-lived assets,
including manufacturing, assembly/test and intangible assets. Intel's results could be affected by adverse economic, social, political and physical/infrastructure
conditions in countries where Intel, its customers or its suppliers operate, including military conflict and other security risks, natural disasters, infrastructure
disruptions, health concerns and fluctuations in currency exchange rates. Expenses, particularly certain marketing and compensation expenses, as well as
restructuring and asset impairment charges, vary depending on the level of demand for Intel's products and the level of revenue and profits. Intel’s results could
be affected by the timing of closing of acquisitions and divestitures. Intel's results could be affected by adverse effects associated with product defects and errata
(deviations from published specifications), and by litigation or regulatory matters involving intellectual property, stockholder, consumer, antitrust, disclosure and
other issues, such as the litigation and regulatory matters described in Intel's SEC reports. An unfavorable ruling could include monetary damages or an injunction
prohibiting Intel from manufacturing or selling one or more products, precluding particular business practices, impacting Intel’s ability to design its products, or
requiring other remedies such as compulsory licensing of intellectual property. A detailed discussion of these and other factors that could affect Intel’s results is
included in Intel’s SEC filings, including the company’s most recent reports on Form 10-Q, Form 10-K and earnings release.

35
Backup
Handling JVM and Java objects
from native code
Memory handling of Java objects
• Memory handling of Java objects is done by
the JVM:
• You only deal with references to these
objects.
• Each time you get a reference, you must not
forget to delete it after use so the JVM can
free it later
• local references are automatically freed when
the native call returns to Java
• Global references are only created by
NewGlobalRef()
Creating a Java string
C:
jstring string =
(*env)->NewStringUTF(env, "new Java String");
C++:
jstring string = env->NewStringUTF("new Java String");

Main difference with compiling JNI code in C and in C++ is the nature of env as you can see
it here.
Remember that otherwise, the API is the same.
Getting a C/C++ string from Java
string
const char *nativeString = (*env)>GetStringUTFChars(javaString, null);
…
(*env)->ReleaseStringUTFChars(env, javaString,
nativeString);
//more secure and efficient:
int tmpjstrlen = env->GetStringUTFLength(tmpjstr);
char* fname = new char[tmpjstrlen + 1];
env->GetStringUTFRegion(tmpjstr, 0, tmpjstrlen, fname);
fname[tmpjstrlen] = 0;
…
delete fname;
Handling Java exceptions
// call to java methods may throw Java exceptions
jthrowable ex = (*env)->ExceptionOccurred(env);
if (ex!=NULL) {
(*env)->ExceptionClear(env);
// deal with exception
}
(*env)->DeleteLocalRef(env, ex);
Calling Java methods
On an object instance:
jclass clazz = (*env)->GetObjectClass(env, obj);
jmethodID mid = (*env)->GetMethodID(env, clazz,
"methodName", "(…)…");
if (mid != NULL)
(*env)->Call<Type>Method(env, obj, mid, parameters…);
Static call:
jclass clazz = (*env)->FindClass(env, "java/lang/String");
jmethodID mid = (*env)->GetStaticMethodID(env, clazz,
"methodName", "(…)…");
if (mid != NULL)
(*env)->CallStatic<Type>Method(env, clazz, mid,
parameters…);

• (…)…: method signature
• parameters: list of parameters expected by the Java method
• <Type>: Java method return type
Throwing Java exceptions
jclass clazz =
(*env->FindClass(env, "java/lang/Exception");

if (clazz!=NULL)
(*env)->ThrowNew(env, clazz, "Message");

The exception will be thrown only when the JNI call returns to Java, it will not break
the current native code execution.
Usando GDB

45

INTEL CONFIDENTIAL
Debugging with GDB and Eclipse
• Native support must be added to your project
• Pass NDK_DEBUG=1 to the ndk-build command, from the
project properties:

NDK_DEBUG flag is supposed to be automatically set for a debug
build, but this is not currently the case.
Debugging with GDB and Eclipse*
• When NDK_DEBUG=1 is specified, a
“gdbserver” file is added to your libraries
Debugging with GDB and Eclipse*
• Debug your project as a native Android*
application:
Debugging with GDB and Eclipse
• From Eclipse “Debug” perspective, you can manipulate
breakpoints and debug your project

• Your application will run before the debugger is
attached, hence breakpoints you set near application
launch will be ignored

Más contenido relacionado

La actualidad más candente

Intel XDK in Brief
Intel XDK in BriefIntel XDK in Brief
Intel XDK in BriefCamilo Corea
 
Getting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse UserGetting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse UserZeroTurnaround
 
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel Apps4All
 
Luis vazquez engineterminology
Luis vazquez engineterminologyLuis vazquez engineterminology
Luis vazquez engineterminologyluisfvazquez1
 
Luis vazquez engineterminology
Luis vazquez engineterminologyLuis vazquez engineterminology
Luis vazquez engineterminologyluisfvazquez1
 
Bringing the Real World Into the Game World
Bringing the Real World Into the Game WorldBringing the Real World Into the Game World
Bringing the Real World Into the Game WorldIntel® Software
 
Mobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDKMobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDKIntel® Software
 
Build HTML5 VR Apps using Intel® XDK
Build HTML5 VR Apps using Intel® XDKBuild HTML5 VR Apps using Intel® XDK
Build HTML5 VR Apps using Intel® XDKIntel® Software
 
Optimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on IntelOptimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on IntelIntel® Software
 
Desenvolvimento de Aplicativo Multiplataforma com Intel® XDK
Desenvolvimento de Aplicativo Multiplataforma com  Intel® XDKDesenvolvimento de Aplicativo Multiplataforma com  Intel® XDK
Desenvolvimento de Aplicativo Multiplataforma com Intel® XDKEvandro Paes
 
Crosswalk and the Intel XDK
Crosswalk and the Intel XDKCrosswalk and the Intel XDK
Crosswalk and the Intel XDKIntel® Software
 
Apps development for Recon HUDs
Apps development for Recon HUDsApps development for Recon HUDs
Apps development for Recon HUDsXavier Hallade
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
 

La actualidad más candente (20)

Intel XDK in Brief
Intel XDK in BriefIntel XDK in Brief
Intel XDK in Brief
 
Getting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse UserGetting Started with IntelliJ IDEA as an Eclipse User
Getting Started with IntelliJ IDEA as an Eclipse User
 
Android Development Tutorial V3
Android Development Tutorial   V3Android Development Tutorial   V3
Android Development Tutorial V3
 
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel
Intel® XDK Разработка мобильных HTML5 приложений. Максим Хухро, Intel
 
Integreation
IntegreationIntegreation
Integreation
 
Sikuli
SikuliSikuli
Sikuli
 
Android and Intel Inside
Android and Intel InsideAndroid and Intel Inside
Android and Intel Inside
 
Luis vazquez engineterminology
Luis vazquez engineterminologyLuis vazquez engineterminology
Luis vazquez engineterminology
 
Luis vazquez engineterminology
Luis vazquez engineterminologyLuis vazquez engineterminology
Luis vazquez engineterminology
 
Bringing the Real World Into the Game World
Bringing the Real World Into the Game WorldBringing the Real World Into the Game World
Bringing the Real World Into the Game World
 
Android tutorial1
Android tutorial1Android tutorial1
Android tutorial1
 
Mobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDKMobile Web Apps and the Intel® XDK
Mobile Web Apps and the Intel® XDK
 
Sonar
Sonar Sonar
Sonar
 
Build HTML5 VR Apps using Intel® XDK
Build HTML5 VR Apps using Intel® XDKBuild HTML5 VR Apps using Intel® XDK
Build HTML5 VR Apps using Intel® XDK
 
Optimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on IntelOptimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on Intel
 
Desenvolvimento de Aplicativo Multiplataforma com Intel® XDK
Desenvolvimento de Aplicativo Multiplataforma com  Intel® XDKDesenvolvimento de Aplicativo Multiplataforma com  Intel® XDK
Desenvolvimento de Aplicativo Multiplataforma com Intel® XDK
 
Sikuli
SikuliSikuli
Sikuli
 
Crosswalk and the Intel XDK
Crosswalk and the Intel XDKCrosswalk and the Intel XDK
Crosswalk and the Intel XDK
 
Apps development for Recon HUDs
Apps development for Recon HUDsApps development for Recon HUDs
Apps development for Recon HUDs
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 

Destacado

Destacado (6)

TDC: Intel Perceptual Computing SDK
TDC: Intel Perceptual Computing SDKTDC: Intel Perceptual Computing SDK
TDC: Intel Perceptual Computing SDK
 
Android Native Apps Hands On
Android Native Apps Hands OnAndroid Native Apps Hands On
Android Native Apps Hands On
 
Android Fat Binaries
Android Fat BinariesAndroid Fat Binaries
Android Fat Binaries
 
TDC-SP: Android sem gastar energia
TDC-SP: Android sem gastar energiaTDC-SP: Android sem gastar energia
TDC-SP: Android sem gastar energia
 
Produzindo Games no Brasil: Processos, Inovação e Desafios
Produzindo Games no Brasil: Processos, Inovação e DesafiosProduzindo Games no Brasil: Processos, Inovação e Desafios
Produzindo Games no Brasil: Processos, Inovação e Desafios
 
Ferramentas Intel Android
Ferramentas Intel AndroidFerramentas Intel Android
Ferramentas Intel Android
 

Similar a Android Native Apps Development

Utilisation des capteurs dans les applications windows 8
Utilisation des capteurs dans les applications windows 8Utilisation des capteurs dans les applications windows 8
Utilisation des capteurs dans les applications windows 8Intel Developer Zone Community
 
Intel Movidius Neural Compute Stick presentation @QConf San Francisco
Intel Movidius Neural Compute Stick presentation @QConf San FranciscoIntel Movidius Neural Compute Stick presentation @QConf San Francisco
Intel Movidius Neural Compute Stick presentation @QConf San FranciscoDarren Crews
 
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute Stick
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute StickBring Intelligence to the Edge with Intel® Movidius™ Neural Compute Stick
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute StickDESMOND YUEN
 
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...Intel IT Center
 
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...Intel® Software
 
Accelerate Your Game Development on Android*
Accelerate Your Game Development on Android*Accelerate Your Game Development on Android*
Accelerate Your Game Development on Android*Intel® Software
 
Deploying Image Classifiers on Intel® Movidius™ Neural Compute Stick
Deploying Image Classifiers on Intel® Movidius™ Neural Compute StickDeploying Image Classifiers on Intel® Movidius™ Neural Compute Stick
Deploying Image Classifiers on Intel® Movidius™ Neural Compute StickIntel® Software
 
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYehMAKERPRO.cc
 
Preparing the Data Center for the Internet of Things
Preparing the Data Center for the Internet of ThingsPreparing the Data Center for the Internet of Things
Preparing the Data Center for the Internet of ThingsIntel IoT
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app developmentAbhishekKumar4779
 
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...Spark Summit
 
Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Stephan Chenette
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easyLars Vogel
 
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...Intel® Software
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012 hakersinfo
 
Getting started as an android developer
Getting started as an  android developerGetting started as an  android developer
Getting started as an android developerAva Meredith
 

Similar a Android Native Apps Development (20)

Android ndk: Entering the native world
Android ndk: Entering the native worldAndroid ndk: Entering the native world
Android ndk: Entering the native world
 
Utilisation des capteurs dans les applications windows 8
Utilisation des capteurs dans les applications windows 8Utilisation des capteurs dans les applications windows 8
Utilisation des capteurs dans les applications windows 8
 
Intel Movidius Neural Compute Stick presentation @QConf San Francisco
Intel Movidius Neural Compute Stick presentation @QConf San FranciscoIntel Movidius Neural Compute Stick presentation @QConf San Francisco
Intel Movidius Neural Compute Stick presentation @QConf San Francisco
 
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute Stick
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute StickBring Intelligence to the Edge with Intel® Movidius™ Neural Compute Stick
Bring Intelligence to the Edge with Intel® Movidius™ Neural Compute Stick
 
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...
Unveiling the Early Universe with Intel Xeon Processors and Intel Xeon Phi at...
 
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...
Intel® RealSense™ Technology: Code Walk-through Presented by Intel Software I...
 
Accelerate Your Game Development on Android*
Accelerate Your Game Development on Android*Accelerate Your Game Development on Android*
Accelerate Your Game Development on Android*
 
Deploying Image Classifiers on Intel® Movidius™ Neural Compute Stick
Deploying Image Classifiers on Intel® Movidius™ Neural Compute StickDeploying Image Classifiers on Intel® Movidius™ Neural Compute Stick
Deploying Image Classifiers on Intel® Movidius™ Neural Compute Stick
 
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh
【視覺進化論】AI智慧視覺運算技術論壇_2_ChungYeh
 
Ultrabook Developer Resources - Intel AppLab Berlin
Ultrabook Developer Resources - Intel AppLab BerlinUltrabook Developer Resources - Intel AppLab Berlin
Ultrabook Developer Resources - Intel AppLab Berlin
 
Preparing the Data Center for the Internet of Things
Preparing the Data Center for the Internet of ThingsPreparing the Data Center for the Internet of Things
Preparing the Data Center for the Internet of Things
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...
BigDL: A Distributed Deep Learning Library on Spark: Spark Summit East talk b...
 
Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013Building Custom Android Malware BruCON 2013
Building Custom Android Malware BruCON 2013
 
Android Programming made easy
Android Programming made easyAndroid Programming made easy
Android Programming made easy
 
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...
Delivering Compelling Usages for Imaging with Intel® Architecture Based Platf...
 
Sf14 mobs002 101f
Sf14 mobs002 101fSf14 mobs002 101f
Sf14 mobs002 101f
 
Android village @nullcon 2012
Android village @nullcon 2012 Android village @nullcon 2012
Android village @nullcon 2012
 
Getting started as an android developer
Getting started as an  android developerGetting started as an  android developer
Getting started as an android developer
 
Presentation1
Presentation1Presentation1
Presentation1
 

Más de Intel Software Brasil

Modernização de código em Xeon® e Xeon Phi™
Modernização de código em Xeon® e Xeon Phi™  Modernização de código em Xeon® e Xeon Phi™
Modernização de código em Xeon® e Xeon Phi™ Intel Software Brasil
 
Escreva sua App sem gastar energia, agora no KitKat
Escreva sua App sem gastar energia, agora no KitKatEscreva sua App sem gastar energia, agora no KitKat
Escreva sua App sem gastar energia, agora no KitKatIntel Software Brasil
 
Desafios do Desenvolvimento Multiplataforma
Desafios do Desenvolvimento MultiplataformaDesafios do Desenvolvimento Multiplataforma
Desafios do Desenvolvimento MultiplataformaIntel Software Brasil
 
Desafios do Desenvolvimento Multi-plataforma
Desafios do Desenvolvimento Multi-plataformaDesafios do Desenvolvimento Multi-plataforma
Desafios do Desenvolvimento Multi-plataformaIntel Software Brasil
 
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEGetting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEIntel Software Brasil
 
Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Intel Software Brasil
 
Principais conceitos técnicas e modelos de programação paralela
Principais conceitos técnicas e modelos de programação paralelaPrincipais conceitos técnicas e modelos de programação paralela
Principais conceitos técnicas e modelos de programação paralelaIntel Software Brasil
 
Principais conceitos e técnicas em vetorização
Principais conceitos e técnicas em vetorizaçãoPrincipais conceitos e técnicas em vetorização
Principais conceitos e técnicas em vetorizaçãoIntel Software Brasil
 
Intel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Software Brasil
 
Benchmarking para sistemas de alto desempenho
Benchmarking para sistemas de alto desempenhoBenchmarking para sistemas de alto desempenho
Benchmarking para sistemas de alto desempenhoIntel Software Brasil
 
Yocto no 1 IoT Day da Telefonica/Vivo
Yocto no 1 IoT Day da Telefonica/VivoYocto no 1 IoT Day da Telefonica/Vivo
Yocto no 1 IoT Day da Telefonica/VivoIntel Software Brasil
 
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...
Otávio Salvador - Yocto project  reduzindo -time to market- do seu próximo pr...Otávio Salvador - Yocto project  reduzindo -time to market- do seu próximo pr...
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...Intel Software Brasil
 
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5Intel Software Brasil
 

Más de Intel Software Brasil (20)

Modernização de código em Xeon® e Xeon Phi™
Modernização de código em Xeon® e Xeon Phi™  Modernização de código em Xeon® e Xeon Phi™
Modernização de código em Xeon® e Xeon Phi™
 
Escreva sua App sem gastar energia, agora no KitKat
Escreva sua App sem gastar energia, agora no KitKatEscreva sua App sem gastar energia, agora no KitKat
Escreva sua App sem gastar energia, agora no KitKat
 
Desafios do Desenvolvimento Multiplataforma
Desafios do Desenvolvimento MultiplataformaDesafios do Desenvolvimento Multiplataforma
Desafios do Desenvolvimento Multiplataforma
 
Desafios do Desenvolvimento Multi-plataforma
Desafios do Desenvolvimento Multi-plataformaDesafios do Desenvolvimento Multi-plataforma
Desafios do Desenvolvimento Multi-plataforma
 
Yocto - 7 masters
Yocto - 7 mastersYocto - 7 masters
Yocto - 7 masters
 
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEGetting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
 
Intel tools to optimize HPC systems
Intel tools to optimize HPC systemsIntel tools to optimize HPC systems
Intel tools to optimize HPC systems
 
Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...
 
Principais conceitos técnicas e modelos de programação paralela
Principais conceitos técnicas e modelos de programação paralelaPrincipais conceitos técnicas e modelos de programação paralela
Principais conceitos técnicas e modelos de programação paralela
 
Principais conceitos e técnicas em vetorização
Principais conceitos e técnicas em vetorizaçãoPrincipais conceitos e técnicas em vetorização
Principais conceitos e técnicas em vetorização
 
Notes on NUMA architecture
Notes on NUMA architectureNotes on NUMA architecture
Notes on NUMA architecture
 
Intel Technologies for High Performance Computing
Intel Technologies for High Performance ComputingIntel Technologies for High Performance Computing
Intel Technologies for High Performance Computing
 
Benchmarking para sistemas de alto desempenho
Benchmarking para sistemas de alto desempenhoBenchmarking para sistemas de alto desempenho
Benchmarking para sistemas de alto desempenho
 
Yocto no 1 IoT Day da Telefonica/Vivo
Yocto no 1 IoT Day da Telefonica/VivoYocto no 1 IoT Day da Telefonica/Vivo
Yocto no 1 IoT Day da Telefonica/Vivo
 
Html5 fisl15
Html5 fisl15Html5 fisl15
Html5 fisl15
 
IoT FISL15
IoT FISL15IoT FISL15
IoT FISL15
 
IoT TDC Floripa 2014
IoT TDC Floripa 2014IoT TDC Floripa 2014
IoT TDC Floripa 2014
 
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...
Otávio Salvador - Yocto project  reduzindo -time to market- do seu próximo pr...Otávio Salvador - Yocto project  reduzindo -time to market- do seu próximo pr...
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...
 
Html5 tdc floripa_2014
Html5 tdc floripa_2014Html5 tdc floripa_2014
Html5 tdc floripa_2014
 
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
 

Último

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Último (20)

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

Android Native Apps Development

  • 1. Desenvolvendo Apps Nativas com NDK Eduardo Carrara de Araujo Software Analyst – Intel Software
  • 2. Agenda • • • • • • Entendendo o mundo Android* Nativo Conhecendo suas ferramentas Preparando-se para a batalha Mãos à obra! Quebrou! E agora? Q&A 2
  • 3. Entendendo o mundo Android* Nativo INTEL CONFIDENTIAL
  • 4. Apps Home Application Framework User Experience Apps As Engrenagens do Robô Contacts Phone Browser Activity Manager Windows* Manager Content Providers View System Package Manager Telephony Manager Resource Manager Location Manager Libraries … Notification Manager Android* Runtime Surface Manager Media Framework SQLite OpenGL* ES FreeType WebKit SGL Middleware … SSL libc Core Libraries Dalvik Virtual Machine … Operating System Linux* Kernel 4 Display Driver Camera Driver Flash Memory Driver Binder (IPC) Driver Keypad Driver WiFi Driver Audio Drivers Power Management
  • 5. Nativo VS. Dalvik* • O que é uma aplicação Android* nativa? • O que a Intel já faz por você? Android Runtime Dalvik Virtual Machine Core Libraries 5
  • 6. Por quê utilizar código nativo? Performance Jogos Processamento Gráfico Criptografia Algoritmos de baixo nível Acesso direto à CPU, GPU e outros recursos de HW • Reuso de código • E por que não utilizar? • • • • • • • Performance • Complexidade 6
  • 8. Android* Native Development Kit (NDK) • O que é? • Conjunto de ferramentas que permitem a implementação de partes da aplicação Android utilizando código nativo em linguagens como C ou C++. • A interação entre o código nativo e a app Android é feita utilizando Java Native Interface (JNI).
  • 9. Java Native Interface (JNI) • O que é? • Interface padrão de programação para interoperabilidade entre bibliotecas nativas de uma plataforma e a máquina virtual Java. • Quando usar? • Acessar funcionalidades dependentes de plataforma não providas pela API padrão do Java. • Re-uso de código. • Porções de código que precisam de tuning de performance. 9
  • 10. Fluxo de Desenvolvimento com NDK C/C++ Code ndkbuild Makefile Java* calls GDB debug JNI APP_ABI := all or APP_ABI := x86 Android* ApplicationsJava Application SDK APIs Java Framework JNI Native Libs Bionic C Library 10 NDK APIs
  • 11. Conheça os limites: A Bionic C • Biblioteca C otimizada para a plataforma Android. • Mais leve que a GNU C. • Não segue o padrão POSIX. • Suporte limitado à pthreads. • Acesso às propriedades do Android 12
  • 13. Instalando o Android* NDK • Baixe o SDK: http://developer.android.com/too ls/sdk/ndk • Baixe o Intel Beacon Mountain: http://software.intel.com/enus/vcsource/tools/beaconmountai n • Integre com o ADT e o CDT no Eclipse*
  • 14. Adicionando Suporte Nativo (Eclipse*) 16
  • 15. Sem o piloto automático Standard Android* Project Structure 1. Create JNI folder for native sources Native Sources - JNI Folder 2. Reuse or create native c/c++ sources 3. Create Android.mk Makefile NDK-BUILD will automatically create ABI libs folders. 4. Build Native libraries using NDKBUILD script. 17
  • 16. Mãos à obra! INTEL CONFIDENTIAL
  • 17. Hello NDK! • Agora que temos um projeto pronto para utilizar código nativo. Qual o próximo passo? • Como integrar o código Java com o C++? 19
  • 18. Integrando Funções Nativas com Java • Declarar métodos nativos em Java: • public native String getHelloMessage(); • A aplicação Java deve carregar a biblioteca antes de utilizá-la: • System.loadLibrary("HelloNDK"); • Implementar em sua biblioteca nativa os métodos a serem utilizados pela aplicação • Os pontos de entrada da biblioteca podem ser criados de duas formas: com a ferramenta Javah ou as registrando na função JNI_onLoad na biblioteca. 20
  • 19. Javah • Gera os “header stubs” apropriados para JNI à partir das classes Java já compiladas. • Example: > javah –d jni –classpath bin/classes com.example.hellojni.HelloJni • Gera o arquivo: com_example_hellojni_HelloJni.h • Com a definição: JNIEXPORT jstring JNICALL Java_com_example_hellojni_HelloJni_stringFromJNI(JN IEnv *, jobject); 21
  • 20. Javah ... { ... tv.setText( stringFromJNI() ); ... } public native String stringFromJNI(); static { System.loadLibrary("hello-jni"); } jstring Java_com_example_hellojni_HelloJni_stringFromJNI(JNIEnv* env, jobject thiz ) { return (*env)->NewStringUTF(env, "Hello from JNI !"); }
  • 21. JNI_onLoad • Registro das funções JNI no carregamento da biblioteca. • Utilizado nos módulos nativos do AOSP. • Sujeito a menos erros durante refatoração. • Melhor local para lidar com o caching de referências à objetos Java. 23
  • 22. JNI_onLoad • Declare a função C++ em sua lib: jstring stringFromJNI(JNIEnv* env, jobject thiz) { return env->NewStringUTF("Hello from JNI !"); } • Crie o mapeamento de funções expostas: static JNINativeMethod exposedMethods[] = { {"stringFromJNI","()Ljava/lang/String;",(void*)stringFromJNI},} • Utilize a ferramenta javap para obter a assinatura dos métodos nativos: javap -s -classpath binclasses -p com.example.hellojni.HelloJni -> Signature: ()Ljava/lang/String; 24
  • 23. JNI_onLoad extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* env; if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) return JNI_ERR; jclass clazz = env>FindClass("com/intel/applab/nativesample/NativeSample"); if(clazz==NULL) return JNI_ERR; env->RegisterNatives(clazz, exposedMethods, sizeof(exposedMethods)/sizeof(JNINativeMethod)); env->DeleteLocalRef(clazz); return JNI_VERSION_1_6; } 25
  • 24. Estamos prontos? Não! • Utilizar o arquivo Application.mk para descrever sua app: • • • • Diretório: jni Descrever os módulos necessários Arquiteturas suportadas: ABI Arquivo opcional mas importante para garantir que seus módulos nativos sejam compilados para diversas plataformas. APP_ABI := armeabi armeabi-v7a x86 Ou APP_ABI := all 26
  • 25. Build it! • Utilizando Eclipse* • Com a integração ADT e NDK no Eclipse* basta compilar a app para gerar as bibliotecas e empacotar seu apk. • Hardcore Mode • Utilizar o script ndk_build para gerar os módulos. • No diretório raíz de sua app execute: • $NDK/ndk_build 27
  • 26. Quebrou! E agora? INTEL CONFIDENTIAL
  • 27. LogCat • Mecanismo básico de logs do Android. No NDK pode ser acessado pela API: <android/log.h> • int __android_log_print(int prio, const char *tag, const char *fmt, ...) • Normalmente utilizado com a macro: • #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "APPTAG", __VA_ARGS__)) • Exemplo • LOGI("accelerometer: x=%f y=%f z=%f", x, y, z); 29
  • 29. Legal Disclaimer INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm Silvermont and other code names featured are used internally within Intel to identify products that are in development and not yet publicly announced for release. Customers, licensees and other third parties are not authorized by Intel to use code names in advertising, promotion or marketing of any product or services and any such use of Intel's internal code names is at the sole risk of the user. Intel, Atom, Look Inside and the Intel logo are trademarks of Intel Corporation in the United States and other countries. *Other names and brands may be claimed as the property of others. Copyright ©2013 Intel Corporation. 32
  • 30. Legal Disclaimer • Roadmap Notice: All products, computer systems, dates and figures specified are preliminary based on current expectations, and are subject to change without notice. • Intel® Virtualization Technology (Intel® VT) requires a computer system with an enabled Intel® processor, BIOS, and virtual machine monitor (VMM). Functionality, performance or other benefits will vary depending on hardware and software configurations. Software applications may not be compatible with all operating systems. Consult your PC manufacturer. For more information, visit http://www.intel.com/go/virtualization. • Software Source Code Disclaimer: Any software source code reprinted in this document is furnished under a software license and may only be used or copied in accordance with the terms of that license. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33
  • 31. Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 34
  • 32. Risk Factors The above statements and any others in this document that refer to plans and expectations for the third quarter, the year and the future are forward-looking statements that involve a number of risks and uncertainties. Words such as “anticipates,” “expects,” “intends,” “plans,” “believes,” “seeks,” “estimates,” “may,” “will,” “should” and their variations identify forward-looking statements. Statements that refer to or are based on projections, uncertain events or assumptions also identify forward-looking statements. Many factors could affect Intel’s actual results, and variances from Intel’s current expectations regarding such factors could cause actual results to differ materially from those expressed in these forward-looking statements. Intel presently considers the following to be the important factors that could cause actual results to differ materially from the company’s expectations. Demand could be different from Intel's expectations due to factors including changes in business and economic conditions; customer acceptance of Intel’s and competitors’ products; supply constraints and other disruptions affecting customers; changes in customer order patterns including order cancellations; and changes in the level of inventory at customers. Uncertainty in global economic and financial conditions poses a risk that consumers and businesses may defer purchases in response to negative financial events, which could negatively affect product demand and other related matters. Intel operates in intensely competitive industries that are characterized by a high percentage of costs that are fixed or difficult to reduce in the short term and product demand that is highly variable and difficult to forecast. Revenue and the gross margin percentage are affected by the timing of Intel product introductions and the demand for and market acceptance of Intel's products; actions taken by Intel's competitors, including product offerings and introductions, marketing programs and pricing pressures and Intel’s response to such actions; and Intel’s ability to respond quickly to technological developments and to incorporate new features into its products. The gross margin percentage could vary significantly from expectations based on capacity utilization; variations in inventory valuation, including variations related to the timing of qualifying products for sale; changes in revenue levels; segment product mix; the timing and execution of the manufacturing ramp and associated costs; start-up costs; excess or obsolete inventory; changes in unit costs; defects or disruptions in the supply of materials or resources; product manufacturing quality/yields; and impairments of long-lived assets, including manufacturing, assembly/test and intangible assets. Intel's results could be affected by adverse economic, social, political and physical/infrastructure conditions in countries where Intel, its customers or its suppliers operate, including military conflict and other security risks, natural disasters, infrastructure disruptions, health concerns and fluctuations in currency exchange rates. Expenses, particularly certain marketing and compensation expenses, as well as restructuring and asset impairment charges, vary depending on the level of demand for Intel's products and the level of revenue and profits. Intel’s results could be affected by the timing of closing of acquisitions and divestitures. Intel's results could be affected by adverse effects associated with product defects and errata (deviations from published specifications), and by litigation or regulatory matters involving intellectual property, stockholder, consumer, antitrust, disclosure and other issues, such as the litigation and regulatory matters described in Intel's SEC reports. An unfavorable ruling could include monetary damages or an injunction prohibiting Intel from manufacturing or selling one or more products, precluding particular business practices, impacting Intel’s ability to design its products, or requiring other remedies such as compulsory licensing of intellectual property. A detailed discussion of these and other factors that could affect Intel’s results is included in Intel’s SEC filings, including the company’s most recent reports on Form 10-Q, Form 10-K and earnings release. 35
  • 33.
  • 35. Handling JVM and Java objects from native code
  • 36. Memory handling of Java objects • Memory handling of Java objects is done by the JVM: • You only deal with references to these objects. • Each time you get a reference, you must not forget to delete it after use so the JVM can free it later • local references are automatically freed when the native call returns to Java • Global references are only created by NewGlobalRef()
  • 37. Creating a Java string C: jstring string = (*env)->NewStringUTF(env, "new Java String"); C++: jstring string = env->NewStringUTF("new Java String"); Main difference with compiling JNI code in C and in C++ is the nature of env as you can see it here. Remember that otherwise, the API is the same.
  • 38. Getting a C/C++ string from Java string const char *nativeString = (*env)>GetStringUTFChars(javaString, null); … (*env)->ReleaseStringUTFChars(env, javaString, nativeString); //more secure and efficient: int tmpjstrlen = env->GetStringUTFLength(tmpjstr); char* fname = new char[tmpjstrlen + 1]; env->GetStringUTFRegion(tmpjstr, 0, tmpjstrlen, fname); fname[tmpjstrlen] = 0; … delete fname;
  • 39. Handling Java exceptions // call to java methods may throw Java exceptions jthrowable ex = (*env)->ExceptionOccurred(env); if (ex!=NULL) { (*env)->ExceptionClear(env); // deal with exception } (*env)->DeleteLocalRef(env, ex);
  • 40. Calling Java methods On an object instance: jclass clazz = (*env)->GetObjectClass(env, obj); jmethodID mid = (*env)->GetMethodID(env, clazz, "methodName", "(…)…"); if (mid != NULL) (*env)->Call<Type>Method(env, obj, mid, parameters…); Static call: jclass clazz = (*env)->FindClass(env, "java/lang/String"); jmethodID mid = (*env)->GetStaticMethodID(env, clazz, "methodName", "(…)…"); if (mid != NULL) (*env)->CallStatic<Type>Method(env, clazz, mid, parameters…); • (…)…: method signature • parameters: list of parameters expected by the Java method • <Type>: Java method return type
  • 41. Throwing Java exceptions jclass clazz = (*env->FindClass(env, "java/lang/Exception"); if (clazz!=NULL) (*env)->ThrowNew(env, clazz, "Message"); The exception will be thrown only when the JNI call returns to Java, it will not break the current native code execution.
  • 43. Debugging with GDB and Eclipse • Native support must be added to your project • Pass NDK_DEBUG=1 to the ndk-build command, from the project properties: NDK_DEBUG flag is supposed to be automatically set for a debug build, but this is not currently the case.
  • 44. Debugging with GDB and Eclipse* • When NDK_DEBUG=1 is specified, a “gdbserver” file is added to your libraries
  • 45. Debugging with GDB and Eclipse* • Debug your project as a native Android* application:
  • 46. Debugging with GDB and Eclipse • From Eclipse “Debug” perspective, you can manipulate breakpoints and debug your project • Your application will run before the debugger is attached, hence breakpoints you set near application launch will be ignored

Notas del editor

  1. Reuso de códigolegadoounão.
  2. http://docs.oracle.com/javase/6/docs/technotes/guides/jni/http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/intro.htmlSuacriaçãofoifeitaparaunificar a forma de fornecercódigonativopara a JVM, desta forma:Vendors de diferentes JVMs e criadores de ferramentasnãoprecisariammais se preocupar com a implementação de diferentes interfaces;Desenvolvedorespoderiamcriarumaversão de seucódigonativo e elefuncionariajunto com diferentes VMsNo final substituipadrões de interfaceamentocomo o Netscape JRI, Microsoft RNI e o COM.O que é possívelfazer com jni:Criar, inspecionar e atualizarobjetos JavaChamarmétodos JavaPegar e lançarexceçõesCarregar classes e obtersuasinformaçõesEfetuarverificação de tiposdurante a execução
  3. Default system STL support: cassertcctypecerrnocfloatclimitscmathcsetjmpcsignalcstddefcstdintcstdiocstdlibcstringctimecwchar new stl_pair.htypeinfo utilityAnything else is _not_ supported, including std::string or std::vector.Static linking is only supported if the application has only one native moduleDon’t forget to load the used library before yours (ieSystem.loadLibrary(&quot;stlport_shared&quot;); )LOCAL_CPPFLAGS := -frtti –fexceptions also works, but LOCAL_CPP_FEATURES is a cleaner way to declare it.Source:ndk\docs\CPLUSPLUS-SUPPORT.html
  4. Com um projeto Android jácriado é possíveladicionarsuporte àumabibliotecanativautilizando o próprio Eclipse*
  5. Credit: TodorMinchevSystem.loadLibrary() will automatically translate MyLib to libMyLib.soThat’s better than using System.load() that takes the path to the .so file.IDZ:To use native c/c++ code in our java source file, we first need to declare JNI call and load the native library.This is a very simple case for declaring and using JNI native calls in Android* App Java sources. Next, there is two solutions: use “javah” tool to generate the JNI header stubs for native code, and add or modify native code to comply with JNI native headers, or load C++ library and map native calls during class load.
  6. http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javah.htmlSource: http://software.intel.com/en-us/articles/creating-and-porting-ndk-based-android-apps-for-ia
  7. http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.htmljstringJava_ -&gt; Java spacecom_example_hellojni_ -&gt; com.example.hellojni packageHelloJni_ -&gt; HelloJni classstringFromJNI( -&gt; stringFromJNI methodJNIEnv* env, -&gt; JNI environmentjobjectthiz) -&gt; HelloJNIjobject instanceSource: IDZ
  8. Proven method: That’s how native code is integrated in AOSP itself : http://code.metager.de/source/xref/android/4.0.3/frameworks-base/services/jni/You get all the native methods registration issues during the load of the library instead of during further function callsYou get rid of functions with a lengthy name that will break when refactoring other parts of the codeYou can add/remove native functions easily (you don’t need to write error prone names by hand or re-run javah and copy/paste parts of it)There is no more potential issue with symbol table (really useful when you want to mix C/C++ code)It is also the best spot to cache Java class/objects references
  9. Javap =&gt; Java Class File Disassembler (http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html)Here it is in C++ as this method is the most useful for C++ code.You’ll see on a following slide the only difference between C and C++ JNI codes.Java VM’s representation of type signatures:http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp16432Complete output of javap:C:\Users\xhallade\workspace\HelloJni&gt;javap -s -classpath bin\classes -p com.example.hellojni.HelloJniCompiled from &quot;HelloJni.java&quot;public class com.example.hellojni.HelloJni extends android.app.Activity{static {}; Signature: ()Vpublic com.example.hellojni.HelloJni(); Signature: ()Vpublic void onCreate(android.os.Bundle); Signature: (Landroid/os/Bundle;)Vpublic native java.lang.StringstringFromJNI(); Signature: ()Ljava/lang/String;public native java.lang.StringunimplementedStringFromJNI(); Signature: ()Ljava/lang/String;}
  10. Add this function to your library. It will be the entry point called during load of your library and it is doing the mapping previously defined.It’s also a good place to get the reference to the JavaVM and other objects (like the main activity) to cache them.Source: developer.android.com and marakana android NDK series
  11. ABI = Android Binary Interfaceadb shell getprop | grepabi
  12. Se vocêchegouatéaquiparabéns! Agora sua app estáredonda e vocêpodedistribuir. Será?E quandoos bugs aparecemcomodebugarseusmódulosnativos?
  13. You may be limited to 16 local references within your JNI environment, so don’t forget to call DeleteLocalRef() after use.
  14. Don’t count on these automatically frees too much
  15. Previous call for creating a String may return a null object, then it’s likely that an exception has occured.Here is the way to get that exception.
  16. You CANNOT do everything in C/C++, only a restricted amount of libraries are exposed in C.Calling Java methods from C/C++ is something you may have to do extensively.Java VM’s representation of type signatures:http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html#wp16432http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/functions.html