开发者

What is the NDK and how can I use JNI? [closed]

开发者 https://www.devze.com 2023-02-05 17:33 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

开发者_如何学C

Closed 7 years ago.

Improve this question

hi give me simple explanation for ndk and jni i am not clear this topic explain what is the main purpose....i am fresher for android application help me....


NDK = Native Development Kit http://developer.android.com/sdk/ndk/overview.html

Basically: you can use parts C or C++ for your android develpment.

It's really hard to give a more basic explanation than this quote (from above link, with annotations in-between by me):

Android applications run in the Dalvik virtual machine.

Meaning: the Android variety of the Java Virtual machine (yes, that's a bit of a shortcut, but gimme a break :) ) So normally you're making your code in JAVA, for this virtual machine.

The NDK allows you to implement parts of your applications using native-code languages such as C and C++.

Now sometimes you have parts code (you might have developed earlier for another platform) that you want to re-use. And they're NOT in JAVA. Then you can use the NDK to incorporate them in your APK.

The NDK provides:

  • A set of tools and build files used to generate native code libraries from C and C++ sources

So you get tools to use your 'old' C/C++ sources as a base, and create libraries for you android app.

  • A way to embed the corresponding native libraries into an application package file (.apk) that can be deployed on Android devices

Now you need more then just libraries. You also get a method to actually use them.

0

精彩评论

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