0

I have a native library that I am using in my Android app. It has 4 .so files(armeabi,armeabi-v7a, mips, x86) in the libs folder. Now, the thing is, each .so file is close to 10 mb. This is making the total apk size around 40 mb. I want to include just one .so file for the relevant architecture and not include the other .so files at all .

This is my application.mk :

# When we build for google play, we build 4 different apk's, each with
# a different version, by uncommenting one of the pairs of lines below.
# Suppose our base version is X:

# Version X: armeabi
#APP_PLATFORM=android-8
#APP_ABI := armeabi

# Version X+1: armeabi-v7a (Much faster due to the availability of hardware
# FP, but cannot be run in the emulator).
APP_PLATFORM=android-8
APP_ABI := armeabi

# Version X+2: x86 (Requires android-9, so a change needs to be made in
# AndroidManifest.xml too)
#APP_PLATFORM=android-9
#APP_ABI := x86

# Version X+3: mips (Requires android-9, so a change needs to be made in
# AndroidManifest.xml too)
#APP_PLATFORM=android-9
#APP_ABI := mips

ifdef NDK_PROFILER
# The profiler doesn't seem to receive ticks when run on release code.
# Accordingly, we need to build as debug - but this turns optimisations
# off, which is less than ideal.
APP_OPTIM := debug
APP_CFLAGS := -O2
else
APP_OPTIM := release
endif
ifdef V8_BUILD
APP_STL := stlport_static
endif
ifdef MEMENTO
APP_CFLAGS += -DMEMENTO -DMEMENTO_LEAKONLY
endif

# If the ndk is r8b then workaround bug by uncommenting the following line
#NDK_TOOLCHAIN_VERSION=4.4.3

# If the ndk is newer than r8c, try using clang.
#NDK_TOOLCHAIN_VERSION=clang3.1

I am new at ndk, so I might be going wrong somewhere, but I have a hunch that this Application.mk doesnt get executed at all. How do I get this to run? Because even though APP_ABI := armeabi is there, I get ALL the .so files in my compiled apk(opened using winrar).

My question is, How do I tell the .mk to build for specific architectures? And how are my changes going to be reflected? I just click on RUN (the green triangle in eclipse).

PS: This is a 3rd party library that I have downloaded, so I dont really know the code inside

harveyslash
  • 5,906
  • 12
  • 58
  • 111
  • possible duplicate of [Android NDK. Decrease size of APK](http://stackoverflow.com/questions/21644150/android-ndk-decrease-size-of-apk) – Alex Cohn Aug 03 '14 at 17:38
  • Can anyone answer my question ? Is it possible to physically delete the .so files before publishing? or will that mess things up ? – harveyslash Aug 03 '14 at 17:42
  • Make sure your **Application.mk** is in **jni** folder; on Linux, check that it starts with capital "A". – Alex Cohn Aug 03 '14 at 17:44
  • I just realized that i have not even istalled the ndk. Can you please tell me if it will be okay to just delete the .so that will not be required right before publishing? – harveyslash Aug 03 '14 at 17:54
  • You can delete the libraries in libs folder of your eclipse project. – Alex Cohn Aug 03 '14 at 18:55
  • So that is not going to adversly affect my project, right ? – harveyslash Aug 04 '14 at 04:02
  • Please look at the linked discussion. There are certain tricks with version numbers to allow PlayStore updates correctly for all ABIs. – Alex Cohn Aug 04 '14 at 05:29
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58590/discussion-between-harvey-slash-and-alex-cohn). – harveyslash Aug 04 '14 at 05:47

0 Answers0