How do I package .so files into my .aar archive?

心已入冬 提交于 2019-12-18 12:23:52

问题


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?


回答1:


If you put it manually, then it should be placed underneath

jni/<platform>/libexample.so

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/

and build plugin will do the rest. As the resulting so-files will be built automatically and placed where they belong to.

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.




回答2:


jni/<platform>/libexample.so

doesn't work.

It should be src/main/jniLibs/<platform>/libexample.so

http://www.codepool.biz/build-so-aar-android-studio.html



来源:https://stackoverflow.com/questions/29803921/how-do-i-package-so-files-into-my-aar-archive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!