【Android】记一次Ninja引发的血案

【Android】记一次Ninja引发的血案

  • 报错日志
  • 报错原因
  • 解决引导
  • 解决方案
  • 完整报错log

报错日志

CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

报错原因

使用了armeabi-v7a,导致cmake编译时找不到Ninja

解决引导

查看Android Studio的sdk目录
【Android】记一次Ninja引发的血案_第1张图片
进入终端依次查看:

我们发现使用ninja这个东西的,但是在终端输入ninja却找不到该命令
原因是没有设置ninja的环境变量

解决方案

配置ninja环境变量
vim ~/.bash_profile
在这里插入图片描述
ANDROID_HOME=你的sdk路径
source ~/.bash_profile
重启终端,编译./gradlew assembleDebug
搞定!!!

完整报错log

[== “CMake Server” ==[

{“supportedProtocolVersions”:[{“isExperimental”:true,“major”:1,“minor”:1}],“type”:“hello”}

]== “CMake Server” ==]

[== “CMake Server” ==[

{
“type”: “handshake”,
“cookie”: “gradle-cmake-cookie”,
“protocolVersion”: {
“isExperimental”: true,
“major”: 1,
“minor”: 1
},
“sourceDirectory”: “D:/EagleEye2.0/app”,
“buildDirectory”: “D:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a”,
“generator”: “Ninja”
}

]== “CMake Server” ==]

[== “CMake Server” ==[

{“cookie”:“gradle-cmake-cookie”,“inReplyTo”:“handshake”,“type”:“reply”}

]== “CMake Server” ==]

[== “CMake Server” ==[

{
“type”: “configure”,
“cacheArguments”: [
“”,
“-DANDROID_ABI\u003darmeabi-v7a”,
“-DANDROID_PLATFORM\u003dandroid-19”,
“-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003dD:\EagleEye2.0\app\build\intermediates\cmake\debug\obj\armeabi-v7a”,
“-DCMAKE_BUILD_TYPE\u003dDebug”,
“-DANDROID_NDK\u003dD:\Androidsdk\android-ndk-r14b”,
“-DCMAKE_CXX_FLAGS\u003d-std\u003dc++11 -frtti -fexceptions”,
“-DCMAKE_SYSTEM_NAME\u003dAndroid”,
“-DCMAKE_ANDROID_ARCH_ABI\u003darmeabi-v7a”,
“-DCMAKE_SYSTEM_VERSION\u003d19”,
“-DCMAKE_EXPORT_COMPILE_COMMANDS\u003dON”,
“-DCMAKE_ANDROID_NDK\u003dD:\Androidsdk\android-ndk-r14b”,
“-DCMAKE_TOOLCHAIN_FILE\u003dD:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a\pre-ndk-r15-wrapper-android.toolchain.cmake”,
“-G Ninja”,
“-DANDROID_ARM_NEON\u003dTRUE”,
“-DANDROID_TOOLCHAIN\u003dclang”,
“-DCMAKE_BUILD_TYPE\u003dRelease”,
“-DANDROID_TOOLCHAIN\u003dclang”,
“-DANDROID_STL\u003dgnustl_static”
]
}

]== “CMake Server” ==]

[== “CMake Server” ==[

{“cookie”:"",“inReplyTo”:“configure”,“message”:“CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.”,“title”:“Error”,“type”:“message”}

]== “CMake Server” ==]

CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

[== “CMake Server” ==[

{“cookie”:"",“inReplyTo”:“configure”,“progressCurrent”:1000,“progressMaximum”:1000,“progressMessage”:“Configuring”,“progressMinimum”:0,“type”:“progress”}

]== “CMake Server” ==]

[== “CMake Server” ==[

{“cookie”:"",“inReplyTo”:“configure”,“message”:“Configuring incomplete, errors occurred!\nSee also “D:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log”.”,“type”:“message”}

]== “CMake Server” ==]

Configuring incomplete, errors occurred!
See also “D:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log”.
Configuring incomplete, errors occurred!
See also “D:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log”.

[== “CMake Server” ==[

{“cookie”:"",“errorMessage”:“Configuration failed.”,“inReplyTo”:“configure”,“type”:“error”}

]== “CMake Server” ==]

Configuration failed.
External native generate JSON debug: JSON generation completed with problems

FAILURE: Build failed with an exception.

你可能感兴趣的:(android)