Mike Laren
Mike Laren

Reputation: 8188

Using armeabi and armeabi-v7a libraries with APK splits

I've been using the new APK splits feature of the 0.13 plugin for android and I managed to halve the size of my most of my build scripts and speed up builds by a factor of 4x. My app has a bit more than 20MB worth of libraries for each platform and keeping the APK size small is a priority. Before 0.13 we had a couple of scripts that dynamically staged .so files in right build folders (depending on which platform we were building for) and executed a full build. This worked fine but was terribly slow and involved an unfortunate mix of gradle and non-gradle scripts.

The latest APK splits feature solved most of my woes but I'm still having a problem with armeabi-v7a libraries. It seems that when gradle builds the armeabi-v7a flavor, it only looks for libraries defined in the /libs/armeabi-v7a folder and ignores libraries were compiled for armeabi but not armeabi-v7a.

For example, this is one of my apps:

App1/
 - libs
  - armeabi
    - lib1.so
    - lib2.so
    - lib3.so
  - armeabi-v7a
    - lib3.so
  - x86
    - lib1.so
    - lib2.so
    - lib3.so

When I compile it for armeabi-v7a then gradle includes armeabi-v7a/lib3.so but not armeabi/lib1.so and armeabi/lib2.so. At runtime, the APK doesn't work (obviously) because it can't find a lib1.so and lib2.so.

Is there a way to tell gradle to add the libraries that are found in armeabi/ but not in armeabi-v7a/ to the armeabi-v7a APKs?

Upvotes: 3

Views: 1630

Answers (1)

Mike Laren
Mike Laren

Reputation: 8188

I opened an issue b.android.com (see https://code.google.com/p/android/issues/detail?id=77490) and it's a known limitation in 0.13+. Hopefully it'll be fixed soon.

Upvotes: 0

Related Questions