简体   繁体   English

编译Android应用程序时,本机代码(JNI)会怎样?

[英]What happens to native code (JNI) when an android app is compiled?

Based on my understanding of Android, it seems that a Java code is first converted into .class files, which are then converted into the proprietary Dalvik byte code format. 根据我对Android的理解,似乎首先将Java代码转换为.class文件,然后将其转换为专有的Dalvik字节码格式。 This can be reverse engineered back to Java source code. 可以将其反向工程回Java源代码。

My questions is, what happens to native code (written in C++), which is used in JNI ? 我的问题是,在JNI中使用的本机代码(用C ++编写)会怎样? Will someone be able to get the c++ source code ? 有人可以获取c ++源代码吗? Or will they just get byte code of the C++ ? 还是只是获取C ++的字节码?

EDIT: I don't know what happens to native code, when an app is compiled for android. 编辑:当为Android编译应用程序时,我不知道本地代码会发生什么。 Can someone explain what happens when you use JNI ? 有人可以解释使用JNI时会发生什么情况吗?

JNI calls are bound in runtime. JNI调用在运行时绑定。 The libraries are stored as is. 库按原样存储。 Android is based on linux kernel so no problems to run library compiled for corresponding architecture Android基于linux内核,因此可以正常运行针对相应架构编译的库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果从Java JNI分配的本机代码中泄漏内存,会发生什么情况? - What happens if you leak memory in native code allocated from Java JNI? 再次加载jni库会怎样? - What happens when jni library is loaded again? 从 JNI 线程调用 fork 时 Java 堆会发生什么 - What happens to Java heap when fork is called from JNI thread Android NDK:应用程序完成后,使用malloc分配的内存将如何处理? - Android NDK: what happens to memory allocated with malloc when app finishes? 在Android中编译java文件后,注释会发生什么? - What happens to comments after the java files are compiled in Android? 什么时候在 React Native 应用程序(使用 Expo)中编译原生模块? - At what point are Native Modules compiled in a React Native app (with Expo)? 我在 Android Studio 中的代码会发生什么? - What happens with my code in Android Studio? 当 if 语句为真(在这段代码中)时会发生什么? - What happens when if statement goes true (in this code)? 当我们启动另一个已安装的应用程序并且想要返回代码时会发生什么? - What happens when we start another installed app and we want to run code on return android优化应用程序会发生什么? - What happens when android optimizes apps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM