开发者

Android App with JNI Interface

Does the Android Marketplace allow JNI based apps? How about the carriers? What are disadvantages to using C/C++ library in Android app开发者_StackOverflow?


Q1: Yes. We have one there.

Q2:

  1. Have to create a JNI layer (more code to maintain)
  2. Have to maintain c/c++ code in addition to Java (no problem if you have people versed in both)
  3. More chances for FC due to pointer manipulation in the c/c++ code (happens with groups that have experience in Java, but not so much in c/c++ - real-life experience)
  4. Slightly more complicated build process (need to setup an environment to build the native code, e.g. cygwin, build both ARM v5 and v7, package them). The NDK has good templates for that, though.
  5. Make use of the C/C++ experience in your team. Picking up Java (the language - syntax) is no big deal. Understanding the subtleties of the JRE and the framework take more time. See the last paragraph below.

You didn't ask, but here we go: the big advantage of having native code is the opportunity to share the same code base across different platforms (e.g. iOS and Android).

Finally, an arguable advantage: there are more opportunities to optimize the native C/C++ code than the Java code, depending on your team background. Please don't flame this point. This is based on the experience or our app. We have experienced C/C++ people who can fine tune memory usage (e.g. save on memory allocation) and write fast C/C++ code. An experienced Java team may write an app that is just as fast, for all I know.


Android has Native Development Kit, or Android NDK to work with c/c++ libraries. The purpose of them is to implement performance-critical parts of your application:

The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code.

So, of course, you can build jni-based applications and they will be applied for the market place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜