广告时间
宝沃汽车-智能系统部
正在招聘Android开发工程师,感兴趣的可以发送简历到 liyilin7@borgward.com,期待跟你成为同事!
前言
作为Android工程师,Java和Kotlin是我们经常使用的开发语言
但在涉及到一些需要高性能,或与底层相关,或与安全相关的功能,就不得不使用C/C++来实现,Java语言也提供了相关接口(JNI)来调用native相关的代码
Android平台又在此基础上提供了native相关的开发套件NDK(native develop kit)让我们更加便利的实现Android平台与native代码之间的交互
作为开端,本篇文章将简单介绍我们使用NDK可以做哪些事情,实现哪些功能
下面,正文开始!
使用NDK可以做什么?
NDK开发并不难,因为NDK只是开发工具,但前提是掌握了C/C++相关的语言基础,JNI相关的调用API,以及Cmake相关的编译知识,本系列也会在此基础上进行的展开分析
安全相关
将部分代码放在C语言中去实现,可以增加逆向分析的难度,对程序来说也更安全。针对这一块目前没有发现比较好的开源库,后面我会自己去做一些代码示例,或者做成开源库的形式
处理音频(Audio)
- audio-echo: https://github.com/android/ndk-samples/blob/main/audio-echo/README.md
- oboe: https://github.com/android/ndk-samples/blob/main/hello-oboe/README.md
- opensl es: https://github.com/android/ndk-samples/blob/main/native-audio/README.md
- MIDI: https://github.com/android/ndk-samples/blob/main/native-midi/README.md
处理视频(Video)
- codec: https://github.com/android/ndk-samples/blob/main/native-codec/README.md
- openMAX: https://github.com/android/ndk-samples/blob/main/native-media/README.md
- ffmpeg: https://github.com/FFmpeg/FFmpeg
处理图片(Picture)
- plasma effect : https://github.com/android/ndk-samples/blob/main/bitmap-plasma/README.md
- webp: https://github.com/android/ndk-samples/blob/main/webp/README.md
- image-p3: https://github.com/android/ndk-samples/blob/main/display-p3/README.md
神经网络(Neural Network)
- NNAPI: https://github.com/android/ndk-samples/blob/main/nn-samples/README.md
OpenGL(Render with OpenGL)
- render tea port: https://github.com/android/ndk-samples/blob/main/teapots/README.md
- render san angles: https://github.com/android/ndk-samples/blob/main/san-angeles/README.md
- sensor graph: https://github.com/android/ndk-samples/blob/main/sensor-graph/README.md
- GLES2.0: https://github.com/android/ndk-samples/blob/main/hello-gl2/README.md
- GLES3.0 : https://github.com/android/ndk-samples/blob/main/gles3jni/README.md
游戏开发(3D Game)
https://github.com/android/ndk-samples/blob/main/endless-tunnel/README.md
后记
在下面的文章中,我将逐项分析相关源码,并拓展实现相关功能,感兴趣的小伙伴可以关注一波!
我是释然,我们下篇文章再见!