How to add C flags in OF Android Studio project?

#1

I would like to add C flags in OF Android Studio project.

I tried to add the flag in the build.gradle like the following:

android {
        // openFrameworks currently only supports compiling against SDK 19
        compileSdkVersion = 25
        buildToolsVersion = "25.0.3"

        defaultConfig.with {
            minSdkVersion.apiLevel    = 19
            targetSdkVersion.apiLevel = 25
            versionCode     =  1
            versionName     = "1.0"


            externalNativeBuild {
                cmake {
                    cFlags "-DLUA_USE_ANDROID"
                }
            }
        }
    }

But I get:

Gradle DSL method not found: ‘cFlags()’

How can I correctly add C flags to an Android Studio Project?


Also, setting the ADDON_CFLAGS in addon_config.mk and creating a project using PG doesn’t seem to have any effect. I tried the following but didn’t work

android/armeabi-v7a:
	ADDON_CFLAGS += -DLUA_USE_ANDROID