美文网首页
Error:Execution failed for task

Error:Execution failed for task

作者: jxtx | 来源:发表于2018-01-20 18:34 被阅读637次

    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"
            }
        }
    }
    

    相关文章

      网友评论

          本文标题:Error:Execution failed for task

          本文链接:https://www.haomeiwen.com/subject/ztwtaxtx.html