Android: Java, C or C++?

后端 未结 6 1939
执念已碎
执念已碎 2021-02-01 15:38

I wrote some simple apps in Android using Java.
But later I found this:

It provides headers and libraries that allow you to build activities, hand

6条回答
  •  佛祖请我去吃肉
    2021-02-01 15:59

    The article you link to has good information. It also links to http://developer.android.com/sdk/ndk/overview.html which says:

    The NDK will not benefit most applications. As a developer, you need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but always increases application complexity. In general, you should only use native code if it is essential to your application, not just because you prefer to program in C/C++.

    Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't allocate much memory, such as signal processing, physics simulation, and so on. Simply re-coding a method to run in C usually does not result in a large performance increase. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.

提交回复
热议问题