在构建CMake时,Ninja出现错误。

3
在构建 CMake 过程中出现了错误。
build.gradle 文件:
apply plugin: 'com.android.application'   android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.example.ffmpeg"
    minSdkVersion 14
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags "-frtti -fexceptions"
            abiFilters 'arm64-v8a'
        }
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
externalNativeBuild {
    cmake {
        path file('CMakeLists.txt')
    }
}}dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}

这里输入图片描述

错误 这里输入图片描述

我的项目

这里输入图片描述

项目结构

这里输入图片描述

如何解决此错误?

Build command failed.

Error while executing process D:\install\sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\Android projects\ffmpeg\app\.cxx\cmake\debug\arm64-v8a native-lib}

ninja: Entering directory `D:\Android projects\ffmpeg\app\.cxx\cmake\debug\arm64-v8a'

ninja: error: FindFirstFileExA(/d:/install/sdk/ndk/21.0.6113669/arm64-v8a): The filename, directory name, or volume label syntax is incorrect.

1
您的配置似乎出了些问题,因为 Ninja 尝试使用的路径不正确。您是否尝试清除 CMake 缓存并重新运行 CMake? - Kevin
1
你的项目路径包含了一个空格。你尝试使用不含空格的路径了吗? - Michael
Michael,我的项目路径不包含任何空格。 - Pradeep Simba
1
"我的项目路径中不包含任何空格。" D:\Android projects\ffmpeg <-- "Android"和"projects"之间有一个空格。 - Michael
我去掉了空格,但它仍然不起作用。 - Pradeep Simba
显示剩余3条评论
1个回答

1

从 build.gradle 文件中删除此代码,然后重新构建。这对我有用。

externalNativeBuild {
    cmake {
        path file('CMakeLists.txt')
    }
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接