Unknown argument ××\××\app\.externalNativeBuild\cmake\debug\armeabi-v7a

FFmpeg播放器项目运行报错:

Build command failed.
Error while executing process E:\AndroidStudio2.0\AndroidSDK\3.10.2.4988404\bin\cmake.exe with arguments {--build I:\android demos\MyPlayer\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
Unknown argument demos\MyPlayer\app\.externalNativeBuild\cmake\debug\armeabi-v7a
Usage: cmake --build  [options] [-- [native-options]]
Options:
            = Project binary directory to be built.
  --target  = Build  instead of default targets.
                   May only be specified once.
  --config  = For multi-configuration tools, choose .
  --clean-first  = Build target 'clean' first, then build.
                   (To clean only, use --target 'clean'.)
  --use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
  --             = Pass remaining options to the native tool.

解析:
首先根据提示 Usage: cmake --build

[options] [-- [native-options]]可以知道是运行cmake --build …命令时报的错,找不到参数中的文件夹。这个命令是在android_gradle_build.json文件中,位置如下: Unknown argument ××\××\app\.externalNativeBuild\cmake\debug\armeabi-v7a_第1张图片

这个文件用来被Android Gradle Plugin中的externalNativeBuild任务解析,将构建命令解析出来,然后编译C/C++代码,最后产生目标so文件。
报错信息中有提示: Unknown argument demos\MyPlayer\app.externalNativeBuild\cmake\debug\armeabi-v7a
而我的项目目录是 I://android demos\MyPlayer\app.externalNativeBuild\cmake\debug\armeabi-v7a
可以明显的看出是目录文件夹android demos中的空格被当成分隔符错误解析导致,解决方法很简单,目录中不要带空格就ok了,改好后果真可以正常运行打包了。

你可能感兴趣的:(ffmpeg)