6

Pretty much exact duplicate of Add a native lib to an APK. Since there was no answer I decided to ask again.

I have an Android project. I have an .so library built with android NDK. And I want to use this .so in my project, preferrably - without using NDK.

So, how do I tell Eclipse (or Android tools) that I need certain .so to be built into my APK?

JoshDM
  • 4,939
  • 7
  • 43
  • 72
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • I think this [link](http://stackoverflow.com/questions/957700/how-to-set-the-java-library-path-from-eclipse) will help u to find ur answer. – himanshu Nov 28 '11 at 12:47
  • 1
    Please don't add tags to your question title, thats what the normal tags are for. –  Nov 28 '11 at 12:58
  • @alextsc: it's not a tag, it's a word that clearly specifies the context of the question and makes the title more clear, what's wrong with that?.. – Violet Giraffe Nov 28 '11 at 13:01
  • 1
    It's redundant: The title says it's an android question. The primary tag says the same. Also try to browse the android tag with lots of these titles, the list looks like "Android: X", "Android: Y", "Android: Z". It's just unneccessary and anoying when browsing for a question to answer by scanning the titles. –  Nov 28 '11 at 13:03
  • @alextsc: Now I see your reason, thanks for explaining. – Violet Giraffe Nov 28 '11 at 13:08

1 Answers1

9

It's actually easier than I expected. All I had to do is place the .so in libs/armeabi-v7a - Eclipse saw it and integrated into APK.

However, I've made this project by copying from another Eclipse project, which was actually building this .so from source. So, I think there were some settings that I would otherwise need to set. Feel free to add corrections or edit my answer.

AZ_
  • 21,688
  • 25
  • 143
  • 191
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 1
    I am doing similar things. But my another library is not compiled for ARM its compiled for another architure so its not elf format still yet i want to add that in apk so by doing that i get error like "arm-linux-androideabi-strip: Unable to recognise the format of the input file" so its delete that library and make apk without that library. DO you know how to stop this? – Jeegar Patel Sep 03 '14 at 11:46
  • @Mr.32: I don't, I have no experience with multiarch APKs. I suggest you post a question. – Violet Giraffe Sep 03 '14 at 13:11
  • add a .so file from directory outside android project: https://stackoverflow.com/questions/50713933/add-so-prebuilt-library-from-another-directory-to-apk – user1506104 Jun 11 '18 at 17:24