Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do so many Android apps use the NDK? [closed]

I've been looking through a few of the apps today (was actually looking to see how many use ACRA) but noticed that a lot of them use the NDK. I've been developing apps for quite some time and have yet to find a need for the NDK and as per the Android Developer site you shouldn't really use it unless you need to:

In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++.

So this has got me to thinking... Am I missing something? I mean here are just a few of the apps using the NDK where I can't really see a need for it:

  • WhatsApp
  • TuneIn Radio Pro
  • textPlus
  • Microsoft Tag
  • Star Chart
  • SPYMouse
  • SoundHound
  • Roll in the Hole
  • Facebook
  • Skype (Likely crypto libs)
  • Raging Thunder
  • QR Droid
  • PocketCloud
  • Camera Zoom FX
  • Blow Up
  • Paper Camera
  • Ocean HD Screen Saver
  • Office Suite
  • Instagram
  • Jump Desktop
  • Fieldrunners
  • Angry Birds apps

I guess my thinking is perhaps they are using the same code on other platforms, libraries written in C and used on iOS, Android & other platforms, but I'm just not convinced that this is the reason. Are there any other things that these apps are likely to be using the NDK for? Other things I guess could be: Licensing, privacy/security (move complicated reverse engineering), Device IDs, Gaming engines etc.

Anyhow, the question is really, do you have any ideas as to why so many apps are using the NDK?

like image 324
Mark Fidell Avatar asked Jan 03 '14 18:01

Mark Fidell


People also ask

Why do we need NDK in Android?

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.

Is NDK necessary for Android studio?

But even if we know C or C++, how would we implement it in our app? So this is where we require NDK to integrate the native-code languages to make it run on the app. Let's see some more advantages of using NDK: It provides a way to embed the equivalent native libraries in the apk.

Which is better NDK or SDK?

You really should use SDK, unless you have a good reason to use NDK. Good reasons may vary, but for example, you could use NDK: If you want to use OpenGL ES 2.0 for Android 2.1 (Eclair), it is only avaiable through NDK.

What is difference between SDK and NDK?

Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more. NDK is a complex and advanced topics.


1 Answers

Not sure if this question is proper for StackOveflow, but as a developer using NDK I can give you two reasons from my perspective:

  • very large code base in C++, which is used also for versions on iPhones and Winrt, and also Windows CE/Desktop. It was developer for years, fixed, tested by lots of users.

  • its harder for hackers to learn what your code is doing, and to break it. But not impossible.

like image 78
marcinj Avatar answered Oct 03 '22 20:10

marcinj