I am trying to add arguments to cmake in order to follow the Android NDK instructions for using the address sanitiser. In the build.gradle file for the native module I therefore have the following:
externalNativeBuild {
cmake {
path "CMakeLists.txt"
arguments "-DANDROID_ARM_MODE=arm", "-DANDROID_STL=c++_shared"
cppFlags "-fsanitize=address -fno-omit-frame-pointer"
}
}
When I try to sync my project (Android Studio v. 3.4.2, Win10) I get the error message:
ERROR: Gradle DSL method not found: 'arguments()'
I've searched the web but can't find any other mention of this problem with the 'arguments' method. I'm using gradle 3.4.2.
What am I missing?
There are two different Gradle DSL objects both named externalNativeBuild
, but with different properties. See this and this.
So you need to set the appropriate properties on the appropriate object:
android {
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DANDROID_ARM_MODE=arm", "-DANDROID_STL=c++_shared"
cppFlags "-fsanitize=address -fno-omit-frame-pointer"
}
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With