Integrating assembly code in JNI

Android NDK allows you to write assembly code at JNI programming. Assembly code is sometimes used to optimize the critical portion of code to achieve the best performance. This recipe does not intend to discuss how to program in assembly. It describes how to integrate assembly code in JNI programming instead.

Getting ready

Read the Passing parameters and receiving returns in primitive types recipe before you continue.

How to do it…

The following steps create a sample Android project that integrates the assembly code:

  1. Create a project named AssemblyInJNI. Set the package name as cookbook.chapter2. Create an activity named AssemblyInJNIActivity. Under the project, create a folder named jni. Refer to the Loading native ...

Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.