Wednesday, May 20, 2015

SDK vs NDK

                  
                SDK is the main development kit for Android apps - it contains tools for Java and resources (png, xml) compiling, packaging to apk file, installing, running and debugging them on a device, an emulator, documentation, etc., etc. NDK is a set of tools to compile C code to shared lib, which you could use in your app - and that's all.

                  You could create an app using SDK only - most of apps does that. However you can't do it using NDK only, because you can't run or publish .so library just like that - you have to use SDK to integrate your library with the rest of an app.

                 Java is the main language for Android development, so it has access to all APIs, also OS requires you to use Java in some places, e.g. when using Android UI. But NDK gets more and more APIs, so it's now possible to develop nearly whole app in C.

                 Java is a VM based based programming lang. c++ is a native language. the difference is that java gets compiled to VM byte code. These byte codes are the same for every android phone out there. the VM takes the byte codes and executes them (there is more, just a quick overview). since every phone has an implementation of the Dalvik VM (the one used for Android) then every application written in java can be run essentially the same on all devices.

                  C++ is compiled for specific hardware in mind. it gets compiled to cpu instructions. if you compile a c++ binary for a x86 machine its not going to run on an ARM based platform. since there are soo many different ARM based platforms, TI OMAP, snapdragon, tegra 2, etc, each with a slightly different implementation of the ARM standard there is an amount of incompatibility in compiled binaries.

                It’s important to know the NDK which is a powerful tool in the development of mobile applications. Especially if you want to develop a multiplatform application, the NDK is unbeatable in this domain. Since the same code written in C + + for Android can be easily ported and run the same way on the iOS, Windows or any other platform without changing the original code. Which actually save a lot of time in the development of applications which are developed for being run on multiple platforms; as games and other classic applications. Thing you cannot do with the SDK.

                 The Android software development kit (SDK) includes a comprehensive set of development tools. These include adebuggerlibraries, a handset emulator based on QEMU, documentation, sample code, and tutorials. Currently supported development platforms include computers running Linux (any modern desktop Linux distribution), Mac OS X 10.5.8 or later, and Windows XP or later. As of March 2015, the SDK is not available on Android itself, but the software development is possible by using specialized Android applications.

                  Libraries written in CC++ and other languages can be compiled to ARMMIPS or x86 native code and installed using the Android Native Development Kit (NDK). Native classes can be called from Java code running under the Dalvik VM using theSystem.loadLibrary call, which is part of the standard Android Java classes. The ADB debugger gives a root shell under the Android Emulator which allows ARM, MIPS or x86 native code to be uploaded and executed. Native code can be compiled using GCC or the Intel C++ Compiler on a standard PC.

Reference link:

No comments:

Post a Comment