简体   繁体   English

Android Studio项目中的C ++代码是否以apk文件结尾(.so文件除外)?

[英]Does the c++ code in an Android Studio project ends up in the apk file (apart from the .so file)?

When I include a c++ file in an Android Studio project, the code get compiled in to a .so file and gets included under 'lib' in the release apk file. 当我在Android Studio项目中包含c ++文件时,代码被编译为.so文件,并包含在发行版apk文件的'lib'下。 Apart from that does the functions in c++ appear like the java methods appear in classes.dex file anywhere else in the apk ? 除此之外,c ++中的函数是否会像java方法的apk一样出现在classes.dex文件中?

My objective is to make sure that every function in the c++ file only appears inside the .so file. 我的目标是确保c ++文件中的每个函数仅出现在.so文件中。

It does not end up with apk file. 它不会以apk文件结尾。 it gives only .so and .a file . 它仅提供.so和.a文件。 where .so file are shared library and .a files are static libraries which cant be used by android application. 其中.so文件是共享库,.a文件是不能由android应用程序使用的静态库。

Yep, all your c++ classes compiled as .so files and your functions are hidden in it. 是的,所有编译为.so文件的c ++类和您的函数都隐藏在其中。 These compiled files imported to your project by putting them in libs folder. 这些已编译的文件通过放入libs文件夹中导入到您的项目中。

On the otherhand, you need to have JNI calls that bridge your c++ functions to be called by Java. 另一方面,您需要具有JNI调用来桥接c ++函数以被Java调用。 These methods are written in Java side and compiled as dex ( d alvik ex ecutable) files. 这些方法是用Java编写的侧面和编译为DEX(d奥尔维克 ecutable)文件。

All these files are packaged as .APK file. 所有这些文件都打包为.APK文件。 It may look like a installation file but exactly its a compressed file. 它可能看起来像一个安装文件,但实际上是一个压缩文件。 More likely .zip .zip可能性更高

Your questions answer; 您的问题回答; Your codes are only being in hidden .so and .dex files. 您的代码仅位于隐藏的.so和.dex文件中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM