Search code examples
android-studioandroid-ndkandroid.mk

Android Studio 3.0.1 Ignoring APP_ABI in Application.mk?


Is Android Studio supposed to ignore values in Application.mk when building NDK applications?

I have changed my Application.mk as follows yet my project keeps building x86, mips etc. It should only be building armeabi-v7a

#APP_ABI := all
APP_ABI := armeabi-v7a

Build output - see the x86 enter image description here

I have noticed references to NDK_APP_ABI and NDK_DEFAULT_ABIS inside the setup-app.mk file. Are these supposed to override what is contained in Application.mk?

Are there variables that can be specified inside the build.gradle files that will propagate into the setup-app.mk file?

Where is the best place to find documentation on this? - Google documentation is very sparse at the moment.


Solution

  • Yes, the technical reason is that gradle specifies APP_ABI on the command line of ndk-build that it generates. And for gnu make, command line parameters override whatever is written in the Makefile.

    Make has the override keyword which could help... Only that this will destroy the delicate structure of externalNativeBuild. If you want your ndkBuild to cooperate with Android Studio, keep your scripts as simple and clean as possible.

    The gradle plugin uses abiFilters to tune the build. Actually, the official docs describe it pretty well.