Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Android Development NDK - Beginner's guide
Rating: 3.7 out of 5(154 ratings)
36,722 students

Android Development NDK - Beginner's guide

Android Development NDK: C++ , FFMPEG , google oboe
Created byThe Apps Firm
Last updated 1/2021
English

What you'll learn

  • You will learn about Android NDK development with C/C++. I will teach you about FFMPEG, Google Oboe and how to apply face filter like instagram and snapchat Apps.

Course content

5 sections19 lectures2h 13m total length
  • What is NDK and why to use it?2:44

    The Native Development Kit (NDK) is a set of tools that allows you to use C and C++ code with Android, and provides platform libraries you can use to manage native activities and access physical device components, such as sensors and touch input.

    But for Android development, Java and Kotlin are the recommended languages. So, why to use native languages in Android? Let' find out the advantages of using native languages in Andoird:
    Very Fast

    Code Re-usability

    So, whenever you want to make some high-performance applications for great speed or want to use some preexisting code written in some native language then you can use C or C++. Due to the speed factor, most of the game developers use C or C++ for writing the code for their games. Also, it becomes an easier task for them to use their C or C++ code in the Android application.

  • NDK contents and structure3:14

    The NDK contains the APIs, documentation, and sample applications that help you write your native code.

    Development tools

    The NDK includes a set of cross-toolchains (compilers, linkers, etc..) that can generate native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms.

    It provides a set of system headers for stable native APIs that are guaranteed to be supported in all later releases of the platform:

    • libc (C library) headers

    • libm (math library) headers

    • JNI interface headers

    • libz (Zlib compression) headers

    • liblog (Android logging) header

    • OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers

    • libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).

    • A Minimal set of headers for C++ support

    • OpenSL ES native audio libraries

    • Android native application APIS

    NDK installation simply requires unzipping it to a suitable location.
    NDK contains a cross-toolchain for ARM and x86 based CPUs, header files and stable libraries.

    Followings are involves

    1- Build scripts (makefiles, awk scripts etc.)

    2- Documentation (HTML)

    3- Platforms (header files and stable libraries)

    4- Build executables (make, awk, sed, echo)

    5- Samples (hello world, JNI example etc.)

    6- Source files that can be linked to an application or library

    7- Test scripts for automated tests of the NDK

    8- ARM Linux and x86 toolchains (compiler, linker etc.)

    9- Documentation entry point

    10- Makefile for building NDK

    11- Build script for building a native application or library

    12- Experimental Windows native build script (working?)

    13- GDB debug start script

    14- Stack trace analysis tool

    15- Readme file

    16- NDK release identifier

  • What is CMake Android Build Script3:00

    CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.


    CMake is an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.

    The ndk-build script builds projects that use the NDK's Make-based build system. There is more specific documentation for the Android.mk and Application.mk configuration used by ndk-build.

    The Android NDK r4 introduced a new tiny shell script, named 'ndk-build', to simplify building machine code.

    The script is located at the top-level directory of the NDK, and shall be invoked from the command-line when in your application project directory, or any of its sub-directories.

    For example: cd $PROJECT $NDK/ndk-build

  • What is JNI ( Java Native Interface )?4:53

    JNI or Java Native Interface is the interface between your Java/Kotlin and the C/C++ code. It defines a way for the byte code that is generated by the Android to communicate with the native code. Java or Kotlin Code uses JNI to communicate with the C or C++ code.


    By programming through the JNI, you can use native methods to:

    • Create, inspect, and update Java objects (including arrays and strings).

    • Call Java methods.

    • Catch and throw exceptions.

    • Load classes and obtain class information.

    • Perform runtime type checking.

    You can also use the JNI with the Invocation API to enable an arbitrary native application to embed the Java VM. This allows programmers to easily make their existing applications Java-enabled without having to link with the VM source code.

  • Installing the Native Development Kit (NDK)1:34

    Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.


    Download the NDK and Tools

    To compile and debug native code for your app, you need the following components:

    • The Android Native Development Kit (NDK): a set of tools that allows you to use C and C++ code with Android.

    • CMake: an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.

    • LLDB: the debugger Android Studio uses to debug native code.

    Download Android Studio - https://developer.android.com/studio

  • Writing a Hello-world Android NDK Program7:14

    What’s the Android NDK?

    The Android Native Development Kit (NDK) is a set of tools that lets developers write parts of their apps in native code (C/C++), squeezing more performance out of devices and achieving better app performance.

    Why do we need the Android NDK?

    The NDK may significantly improve application performance, especially for processor-bound applications. Many multimedia applications and games use native code for processor-intensive tasks. There are three reasons why C/C++ can offer performance improvements:

    • C/C++ code is compiled to the binary that runs directly on the operating system, while Java code is compiled to Java bytecode and executed by the Java Virtual Machine.

    • Native code allows developers to make use of certain processor features that are not accessible via the Android SDK.

    • Critical code can be optimized at the assembly level.

    Used in conjunction with the Android SDK, the NDK toolset provides access to platform libraries that app developers can use to manage native activities and access physical device components such as sensors and touch input. It’s also possible to use your own libraries or to use popular C/C++ libraries that have no equivalents in Java (such as the FFmpeg library written in C/C++ to process audio and video or the Unigraphics library to process bitmaps).

Requirements

  • Basic Java and C/C++ knowledge

Description

A complete  course on Android App Development using Android NDK

In this course, you are going to learn about android NDK development. After enrolling and watching the whole course you will able to develop android apps with C/C++. I will introduce some famous libraries in this course, like FFMPEG, Google Obeo and Banuba SDK.
So you can develop apps like snap chat, Instagram and tik talk filter features in your app and with the help of FFMPEG, you will be able to develop video and audio editing apps.

Who this course is for:

  • Junior android developers