ExternalNativeBuild

DSL object to configure external native builds using CMake or ndk-build.

android {
    externalNativeBuild {
        // Encapsulates your CMake build configurations.
        // For ndk-build, instead use the ndkBuild block.
        cmake {
            // Specifies a path to your CMake build script that's
            // relative to the build.gradle file.
            path "CMakeLists.txt"
        }
    }
}

To learn more about including external native builds to your Android Studio projects, read Add C and C++ Code to Your Project.

Properties

PropertyDescription
cmake

Encapsulates CMake build options.

ndkBuild

Encapsulates ndk-build options.

Methods

No methods

Script blocks

BlockDescription
cmake

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your CMakeLists.txt build script and build output directory.

ndkBuild

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your Android.mk build script and build output directory.

Property details

Encapsulates CMake build options.

For more information, see CmakeOptions.

Encapsulates ndk-build options.

For more information, see NdkBuildOptions.

Script block details

cmake { }

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your CMakeLists.txt build script and build output directory.

For more information about the properties you can configure in this block, see CmakeOptions.

Delegates to:
CmakeOptions from cmake

ndkBuild { }

Encapsulates per-variant configurations for your external ndk-build project, such as the path to your Android.mk build script and build output directory.

For more information about the properties you can configure in this block, see NdkBuildOptions.

Delegates to:
NdkBuildOptions from ndkBuild