Ndk

public interface Ndk


DSL object for per-variant NDK settings, such as the ABI filter.

Summary

Public methods

abstract @NonNull Set<@NonNull String>

Specifies the Application Binary Interfaces (ABI) that Gradle should build outputs for and package with your APK.

abstract String

The C Flags

abstract String

The type of debug metadata which will be packaged in the app bundle.

abstract Integer

Number of parallel threads to spawn.

abstract List<@NonNull String>

The LD Libs

abstract String

The module name

abstract String

The APP_STL value

abstract void
setCFlags(String cFlags)

The C Flags

abstract void
setDebugSymbolLevel(String debugSymbolLevel)

The type of debug metadata which will be packaged in the app bundle.

abstract void

Number of parallel threads to spawn.

abstract void
setModuleName(String moduleName)

The module name

abstract void

The APP_STL value

Public methods

getAbiFilters

abstract @NonNull Set<@NonNull StringgetAbiFilters()

Specifies the Application Binary Interfaces (ABI) that Gradle should build outputs for and package with your APK.

You can list any subset of the ABIs the NDK supports, as shown below:

android {
// Similar to other properties in the defaultConfig block, you can override
// these properties for each product flavor in your build configuration.
defaultConfig {
ndk {
// Tells Gradle to build outputs for the following ABIs and package
// them into your APK.
abiFilters 'x86', 'x86_64', 'armeabi'
}
}
}

When this flag is not configured, Gradle builds and packages all available ABIs.

To reduce the size of your APK, consider configuring multiple APKs based on ABI—instead of creating one large APK with all versions of your native libraries, Gradle creates a separate APK for each ABI you want to support and only packages the files each ABI needs.

getCFlags

abstract String getCFlags()

The C Flags

getDebugSymbolLevel

abstract String getDebugSymbolLevel()

The type of debug metadata which will be packaged in the app bundle.

Supported values are 'none' (default, no native debug metadata will be packaged), 'symbol_table' (only the symbol tables will be packaged), and 'full' (the debug info and symbol tables will be packaged).

Example usage:

android {
    buildTypes {
        release {
            ndk {
                debugSymbolLevel 'symbol_table'
            }
        }
    }
}

getJobs

abstract Integer getJobs()

Number of parallel threads to spawn.

getLdLibs

abstract List<@NonNull StringgetLdLibs()

The LD Libs

getModuleName

abstract String getModuleName()

The module name

getStl

abstract String getStl()

The APP_STL value

setCFlags

abstract void setCFlags(String cFlags)

The C Flags

setDebugSymbolLevel

abstract void setDebugSymbolLevel(String debugSymbolLevel)

The type of debug metadata which will be packaged in the app bundle.

Supported values are 'none' (default, no native debug metadata will be packaged), 'symbol_table' (only the symbol tables will be packaged), and 'full' (the debug info and symbol tables will be packaged).

Example usage:

android {
    buildTypes {
        release {
            ndk {
                debugSymbolLevel 'symbol_table'
            }
        }
    }
}

setJobs

abstract void setJobs(Integer jobs)

Number of parallel threads to spawn.

setModuleName

abstract void setModuleName(String moduleName)

The module name

setStl

abstract void setStl(String stl)

The APP_STL value