How to load a native shared object, in a jar, from an android application?

爷,独闯天下 提交于 2019-12-05 10:26:34

Well! It turns out it was something so tiny, that it caused me eight hours of headaches.

I found that my libFoo.so wasn't showing up in my app.apk/lib/armeabi/libFoo.so like it did when unity built the apks. I assumed it had something to do with that, so I started looking for settings to make sure that my lib folder was copied to the apk.

As it turns out, the lib folder is not, however...

Remember how I said I tried it in (on the android application side):

./lib/libFoo.so
-and-
./lib/armeabi/libFoo.so

Turns out, what I needed to do was put it in a similar path. Oh so similar.

./libs/armeabi/libFoo.so

Yeah. libs. With a s.

In fact, when I renamed my folder 'lib' to 'libs', it changed the icon of the folder in eclipse to have the little android symbol on it, like the bin or res folders have. And sure enough, when you build the apk, the lib/armeabi folder is there (notice it's named 'lib' in the apk, and not 'libs'. This still confuses me.)

One of my co-workers (that was working on this project before me) told me that somewhere along the line, the folder used to be 'lib', but was then changed to 'libs' in a later version of the android SDK. Either way, having just picked up this project, I didn't realize that the folder should have been named 'lib', as it seemed fine to me. I was about ready to pull my hair out. I'm leaving this here in the hopes that SOMEONE has the same problem I did, and manages to solve it a bit faster.

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