Search code examples
androidandroid-ndkarmarmv7

Why use armeabi-v7a code over armeabi code?


In my current project I make use of multiple .so files. These are located at the armeabi and armeabi-v7a folder. Unfortunately one of the .so files is a 6MB and I need to reduce file size. Instead of having a fat APK file, I would like to use just the armeabi files and remove the armeabi-v7a folder.

According to the NDK documentation, armeabi-v7a code is extended armeabi code which can contain extra CPU instructions. This all goes beyond my expertise, but I question why one would like to have both armeabi-v7a and armeabi code. There must be a good reason to have both, right?

On my test devices this all seem to work fine. These have ARM v7 CPU's. Is it safe to assume that everything works now?


Solution

  • Depends on what your native code does, but v7a has support for hardware floating point operations, which makes a huge difference. armeabi will work fine on all devices, but will be a lot slower, and won't take advantage of newer devices' CPU capabilities. Do take some benchmarks for your particular application, but removing the armeabi-v7a binaries is generally not a good idea. If you need to reduce size, you might want to have two separate apks for older (armeabi) and newer (armeabi-v7a) devices.

    Update 2012-09; Google's Play Store finally has support for uploading different APKs (each targeting a different CPU architecture), with the so-called "multiple APKs" feature:
    https://developer.android.com/google/play/publishing/multiple-apks

    Where maybe each APK needs to have a different version code (even if they all are actually the same version, just with different CPU target).

    But Update 2023; Google recommends creating "App bundle" instead of using "multiple APKs" feature:
    https://developer.android.com/guide/app-bundle

    Where for "App bundle", the Play store can automatically bring down the download size, based on the device which's downloading.