androidandroid-ndk

Application.mk is ignored by Android Studio


I would like to include c++ header iostream into my NDK code. In order to do that, I have to include APP_STL := stlport_static (or similar) into Application.mk file as mentioned in Android ndk-build iostream: No such file or directory.

It all works well if I compile using command line ndk-build, however while compiling using Android Studio, I still get the same error as iostream not found. It looks like application.mk is ignored by Android Studio and I am not sure how to configure it in build.gradle. Can anyone help me including APP_STL := stlport_static using android studio?

Thanks


Solution

  • It looks like at the moment there is no support for including Application.mk file in build.gradle, however adding stl "stlport_static" under ndk section of build.gradle works well (thanks Michael for quick reply).

    Under defaultConfig section, add:

        ndk {
            moduleName "app"
            stl "stlport_static"
        }
    

    Details can be found at: https://groups.google.com/forum/#!topic/adt-dev/pHnST37HrlM