Error:Execution failed for task ':app:compileDebugNdk'. > Error: Your project contains C++ files but

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

Android studio3.0 开发jni时遇到的

原因:在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"
        }
    }
}



猜你喜欢

转载自blog.csdn.net/baidu_21345205/article/details/79115919
今日推荐