如何将.so文件打包到我的.aar存档中? [英] How do I package .so files into my .aar archive?
问题描述
我想知道是否可以将本机.so文件打包到我的.aar文件中?如果是这样,.so文件会放在哪里,关于此我可以阅读任何引用吗?
I was wondering if it's possible to package my native .so files into my .aar file? If so, where would the .so files go and are there any references that I can read in regards to this?
推荐答案
如果手动放置,则应将其放置在下面
If you put it manually, then it should be placed underneath
jni/<platform>/libexample.so
其中平台是目标CPU平台,例如"armeabi","x86"等.通常,那里会有多个平台的so-file.如果您使用Gradle从源代码构建,则只需将本机源代码放入
where platform is a target CPU platform like "armeabi", "x86" etc. Typically you will have so-files for multiple platforms there. If you build from source code using Gradle you could simply put your native source code to
src/main/jni/
和构建插件将完成其余的工作.这样生成的so-file将自动生成并放置在它们所属的位置.
and build plugin will do the rest. As the resulting so-files will be built automatically and placed where they belong to.
关于参考资料,我已经在专门针对Gradle的Android构建插件的网站上的某处提到了此内容.从那时起,我再也找不到该页面.但是您可以查看插件的源代码以获取更多详细信息.
Regarding the references, I've seen this been mentioned somewhere on the site dedicated to Android build plugin for Gradle. Since then I wasn't able to find this page again. But you can check out plugin's source code for more details.
这篇关于如何将.so文件打包到我的.aar存档中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!