Adding native library with other extension than .so to apk archive.

728 views
Skip to first unread message

leoha

unread,
Mar 23, 2010, 9:57:27 PM3/23/10
to android-ndk
Hello,

Is there any possibility to pack an apk with native libraries with
names not ending with .so? Let's say I have ported libraries and have
files libnative.so & libnative.so.5.0 and I need both of the files
included in apk package. But if I copy those files into /libs/ only
libnative.so got packed into apk. (I'm using eclipse w/ adt plugin for
development). Is there any simple solution? How to overcome this
"problem"?

Thank you!

--
Regards,
Mateusz

murali raju

unread,
Mar 23, 2010, 10:39:16 PM3/23/10
to andro...@googlegroups.com
did u add those libraries?

i mean right click(in eclipse) on package>properties>java build>libraries>add libraries.


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Dianne Hackborn

unread,
Mar 24, 2010, 1:45:08 AM3/24/10
to andro...@googlegroups.com
We don't do shared library versioning, so you really should use just .so as the suffix.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

leoha

unread,
Mar 24, 2010, 3:23:09 AM3/24/10
to android-ndk
Yes I did. Didn't help or I didn't add them in an appriopriate way.
Can you share details?

On Mar 24, 3:39 am, murali raju <manutd...@gmail.com> wrote:
> did u add those libraries?
>
> i mean right click(in eclipse) on package>properties>java
> build>libraries>add libraries.
>

> On Wed, Mar 24, 2010 at 7:27 AM, leoha <kramarc...@gmail.com> wrote:
> > Hello,
>
> > Is there any possibility to pack an apk with native libraries with
> > names not ending with .so? Let's say I have ported libraries and have
> > files libnative.so & libnative.so.5.0 and I need both of the files
> > included in apk package. But if I copy those files into /libs/ only
> > libnative.so got packed into apk. (I'm using eclipse w/ adt plugin for
> > development). Is there any simple solution? How to overcome this
> > "problem"?
>
> > Thank you!
>
> > --
> > Regards,
> > Mateusz
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>

leoha

unread,
Mar 24, 2010, 3:24:37 AM3/24/10
to android-ndk
But I have to do due to license of ported library.
I believe there has to be the way to put custom files into apk.


On Mar 24, 6:45 am, Dianne Hackborn <hack...@android.com> wrote:
> We don't do shared library versioning, so you really should use just .so as
> the suffix.
>
>
>
> On Tue, Mar 23, 2010 at 6:57 PM, leoha <kramarc...@gmail.com> wrote:
> > Hello,
>
> > Is there any possibility to pack an apk with native libraries with
> > names not ending with .so? Let's say I have ported libraries and have
> > files libnative.so & libnative.so.5.0 and I need both of the files
> > included in apk package. But if I copy those files into /libs/ only
> > libnative.so got packed into apk. (I'm using eclipse w/ adt plugin for
> > development). Is there any simple solution? How to overcome this
> > "problem"?
>
> > Thank you!
>
> > --
> > Regards,
> > Mateusz
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to andro...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer

> hack...@android.com

David Turner

unread,
Mar 24, 2010, 10:47:37 AM3/24/10
to andro...@googlegroups.com
The packaging tools and the system's package manager will only look for files that look like "lib<name>.so" for the content of lib/armeabi/.
On the other hand, you can just put your libnative.so.5.0 as a raw resource, and uncompress it manually into your /data/data/<appname>/lib directory on first run.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

leoha

unread,
Mar 24, 2010, 11:14:42 AM3/24/10
to android-ndk
When I was using ant tool I was able to define template rule that
catch files (in the case native libs) I wanted. The issue is how to
change this rule in eclipse plugin since it seems there no other
solution.
Maybe I should switch to ant... eclipse plugin is barely
configurable. ;(

> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>

Xavier Ducrohet

unread,
Mar 24, 2010, 5:40:45 PM3/24/10
to andro...@googlegroups.com
If all you want is to put that file inside the apk in the same
location as the .so you can put it inside your source folder in a java
package called lib.armeabi

This file will then be considered a java resource and will be put
inside the apk. Howerver, It will not however be copied to
/data/data/<appname>/lib alongside the .so upon your application's
installation, so you may have to do this manually if you want.

Xav

> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>
>

--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.

Please do not send me questions directly. Thanks!

leoha

unread,
Mar 24, 2010, 9:37:39 PM3/24/10
to android-ndk
Xav,

Is there any way to make a package which during installation copies
those .so files to /data/data/app/lib directory? If so please give me
some details. Any help is welcome. Tia.

--
Mateusz

> > For more options, visit this group athttp://groups.google.com/group/android-ndk?hl=en.

Dianne Hackborn

unread,
Mar 25, 2010, 3:01:53 AM3/25/10
to andro...@googlegroups.com
Libraries need to be named with a .so extension for the platform to copy them at install time.

This is just a convenience, though.  As has been said, you can just as well include this library as a raw resource (or plain asset) and copy it yourself.

For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
Dianne Hackborn
Android framework engineer

Dianne Hackborn

unread,
Mar 25, 2010, 3:03:11 AM3/25/10
to andro...@googlegroups.com
(Note though you'll need to copy it to a different directory, since the lib directory is owned by the system.)

Kenichi Takemura

unread,
Sep 20, 2014, 6:39:15 AM9/20/14
to andro...@googlegroups.com, hac...@android.com

Hi

I found this post from 2010 its been years since then but I am having the same problem at the moment.
I wonder how the original author leoha solved this problem before.

Did you copy shared libraries in your application?

I think its still the same in Android now. Only *.so libraries are copied on actual Android device.
I am looking for a better solution than copying libraries on files directory if any.

Thanks
Kenichi

J Decker

unread,
Sep 21, 2014, 11:01:20 PM9/21/14
to andro...@googlegroups.com, hac...@android.com
On Sat, Sep 20, 2014 at 3:39 AM, Kenichi Takemura <kenkenpa...@gmail.com> wrote:

Hi

I found this post from 2010 its been years since then but I am having the same problem at the moment.
I wonder how the original author leoha solved this problem before.

Did you copy shared libraries in your application?

I think its still the same in Android now. Only *.so libraries are copied on actual Android device.
I am looking for a better solution than copying libraries on files directory if any.


Actually I think it's lib*.so ... and it's on the packaging side that they don't get put in the APK.
probably just have to  consent to using that limitation.   why is this an issue for you?  Me, I had separate extensions for 'plugin' dll's so I could just scan them... but prepending lib and postifxnig .so and modifying the scan a little I can still use them.
 
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.

Felix Homann

unread,
Sep 23, 2014, 12:08:15 PM9/23/14
to andro...@googlegroups.com
@Dianne Hackborn:
What's the rationale in not supporting versioned libs?

The main issue with not supporting them is that it's unnecessarily difficult to satisfy library dependencies. E.g. libsndfile depends on specific versions of libflac, libvorbis and libogg. It doesn't seem very sane that you have to either use a workaround or create your own not-versioning build system for such libraries while autotools work just fine together with a standalone NDK toolchain.

@Xavier:
We've discussed this a couple of months ago when I filed a wish list report for Android Studio. My impression was that you (or Thor or Alex Ruiz) were trying to get support for versioned libs into Android L (or M). I still think this would be a great enhancement!

Reply all
Reply to author
Forward
0 new messages