Google is committed to advancing racial equity for Black communities. See how.

ExternalNativeBuild

@Incubating interface ExternalNativeBuild
com.android.build.api.dsl.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

Summary

Public methods

abstract Unit
cmake(action: Cmake.() -> Unit)

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

abstract Unit
ndkBuild(action: NdkBuild.() -> Unit)

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

Properties

abstract 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.

abstract 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.

Public methods

cmake

abstract fun cmake(action: Cmake.() -> Unit): Unit

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 Cmake

ndkBuild

abstract fun ndkBuild(action: NdkBuild.() -> Unit): Unit

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 NdkBuild

Properties

cmake

abstract val cmake: 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 Cmake

ndkBuild

abstract val ndkBuild: 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 NdkBuild