tags:

views:

64

answers:

3

Hello, I would like to create a zip file from files located on the sd card, I have managed to do that using java but I think that the result is too slow, so I thought of going native using the android NDK.

My questions are:

Does anyone know any C/C++ library to zip unzip files that will work on android?

How to know if the library will work on android?

will this make any difference on performance?

reagrds maxsap

A: 

I personally like 7zip, they are open sourced here. You can try compiling this within your app in Android NDK. gzip is also another good option.

omermuhammed
thanks a lot for the responce I will try that even I am new to C++ and ndk and don't know how :p
maxsap
You may want to look into gzip then, I think its C based.
omermuhammed
+1  A: 

With regard to your question "How to know if the library will work on Android" - it depends on the dependencies that the library has. The standard google NDK has very limited C++ support. If it's written in C you're probably OK, but if it's C++ you need to make sure it uses ONLY the following headers/libraries:

  • libc (C library) headers
  • libm (math library) headers
  • JNI interface headers
  • libz (Zlib compression) headers
  • liblog (Android logging) header
  • OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers
  • libjnigraphics (Pixel buffer access) header (for Android 2.2 and above).
  • A Minimal set of headers for C++ support

(From homepage)

If you need full C++ support, you will need to use the Crystax NDK.

Be forewarned - the process of cross compilation is Very. Complicated. If you're not extremely comfortable on the command line and with the ins and outs of C compilation, linking, etc., I would look for an alternative solution.

I82Much
A: 

Given how core zip files (apk files, jar files) are to android, I'd be very surprised if the java zip file functions aren't using native implementations of the actual algorithms.

Remember the SD card itself is slow compared to ordinary disks.

Chris Stratton