外部本机构建问题,构建命令失败,使用参数{-HF执行'C:/ User / user ... / cmake.exe'时出错

时间:2018-08-05 13:08:19

标签: android cmake

最近,我尝试将cmake附加到我现有的android studio项目中。我正在搜索,因为过去四天尚未成功。请不要将此标记为重复。我正在Windows 8.1pro中使用gradle版本2.14.1运行android studio 2.2.1。 我的build.gradle(应用程序级别):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId = "com.example.user.myproject"
        minSdkVersion 17
        targetSdkVersion 24
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_TOOLCHAIN=clang'
            }

        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // proguardFiles.add(file("proguard-rules.txt"))
        }
    }
    externalNativeBuild {
        cmake {
            path 'src/main/cpp/CMakeLists.txt'
        }
    }
    productFlavors {
        arm7 {
            // in the future, ndk.abiFilter might also work
            ndk {
                abiFilter 'armeabi-v7a'
            }
        }
        arm8 {
            ndk {
                abiFilters 'arm64-v8a'
            }
        }
        arm {
            ndk {
                abiFilter 'armeabi'
            }
        }
        x86 {
            ndk {
                abiFilter 'x86'
            }
        }
        x86_64 {
            ndk {
                abiFilter 'x86_64'
            }
        }
        mips {
            ndk {
                abiFilters 'mips', 'mips64'
            }
        }
        universal {
            ndk {
                abiFilters 'mips', 'mips64', 'x86', 'x86_64'
            }
        }
    }
}

依赖性{

我的CMakeLists.txt(路径:“ app / src / main / cpp”)

cmake_minimum_required(VERSION 3.4.1)

add_library(本地lib             共享             src / main / cpp / native-lib.cpp)

我在消息视图中收到此错误:

Error while executing 'C:\Users\User\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe' with arguments {-HF:\MyProject\app\src\main\cpp -BF:\MyProject\app\.externalNativeBuild\cmake\x86_64Debug\x86_64 -GAndroid Gradle - Ninja -DANDROID_ABI=x86_64 -DANDROID_NDK=C:\Users\User\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=F:\MyProject\app\build\intermediates\cmake\x86_64\debug\obj\x86_64 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\User\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\User\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_TOOLCHAIN=clang}

我不知道这是怎么回事。

0 个答案:

没有答案