軟體開發隨筆

Android NDK

商業,創業,業務開發,自媒體經營,生活美食,時事分析。

這是我的 FB粉專 以及 IG,我也滿常使用 Threads,歡迎大家追蹤互動~

在創業、職涯、人生的路上,希望大家一起陪伴與成長。

OGRE Android uses Android NDK to build. Let's investigate somehow how Android NDK works.

Objective:
1. Build the NDK development environment.
2. Experience the Android APP publishing process.

Work log:
1. followed the nice link to build and run the hello-jni sample.
http://www.ntu.edu.sg/home/ehchua/programming/android/Android_NDK.html

2. published the project on google play:
https://play.google.com/store/apps/details?id=larry.myndkexperimentalproject&feature=search_result#?t=W251bGwsMSwxLDEsImxhcnJ5Lm15bmRrZXhwZXJpbWVudGFscHJvamVjdCJd

Note:
1. The sample is actually only C (not C++). I tried using C++, but the application crashed at run-time. The error was something like JNI_OnLoad was not found, the JNI C function was not implemented, etc. The following link is about the solution:
http://cheng-min-i-taiwan.blogspot.tw/2011/08/java-native-interface-jni-android-c.html
The issue is not easy so I leave it for future investigation.


2. When to use NDK? Nice link:
http://cheng-min-i-taiwan.blogspot.tw/2011/05/java-native-interface-jni.html

The NDK interface is not easy to maintain (see the problem in note.1). Except game engines, the timings to use NDK should be just like the above link. But personally I doubt how much the benefit you get compared to the overhead you pay when implementing an algorithm using NDK, and I am still curious about when to use NDK in practice.

The official web page:
http://developer.android.com/tools/sdk/ndk/index.html
“using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app”

3. OGRE Android building tutorial:
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide&tikiversion=Android
The sample was successfully built and run, but the details of the building steps are still unknown.

商業,創業,業務開發,自媒體經營,生活美食,時事分析。

這是我的 FB粉專 以及 IG,我也滿常使用 Threads,歡迎大家追蹤互動~

在創業、職涯、人生的路上,希望大家一起陪伴與成長。