Error:Execution failed for task
2018-01-20 本文已影响637人
jxtx
Android studio3.0 开发jni时遇到的
Error:Execution failed for task ':app:compileDebugNdk'.
Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
https://developer.android.com/r/tools/experimental-plugin.html
原因:在app的build.gradle中没用配置cmake
android {
...
defaultConfig {
....
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -D__CORRECT_ISO_CPP_WCHAR_H_PROTO"
}
// ndk {
// abiFilters "armeabi", "armeabi-v7a"
// }
}
}
buildTypes {
...
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}