Where exactly is the NDK native code executed

I have a confusion in the native code life cycle in Android aps. I saw links that say that the internal code runs inside the Dalvik VM, but is that true? I got the impression that only Dalvik bytecode works in VM. On the other hand, native code uses JNI, which is called from Java inside a virtual machine. And finally, does the use of NativeActivity matter?

I thought I knew NDK well until I sat down and tried to explain it to myself. I'm not even sure that I am asking the question in a reasonable way.

+7
source share
1 answer

I saw links that say that the internal code runs inside the Dalvik VM, but is that true?

Runs inside the process containing the Dalvik VM. Personally, I would not describe this as execution inside a virtual machine - as you say, Dalvik bytecode is executed inside a virtual machine. "Under the control of Dalvik VM" it would be better to formulate, IMHO. Of course, it comes down to your definition of "in," I suppose.

Finally, does using NativeActivity make any difference?

Not so, since NativeActivity implemented in Java . Although you may not have Java, Java is still slightly involved in the action of running your own code.

+8
source

All Articles