【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目录

进入终端依次查看:

我们发现使用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.

更多相关文章

  1. android4.1编译运行
  2. Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:
  3. 【FAQ】Ubuntu环境下ant编译android代码问题
  4. Android(安卓)Studio 编译 freso问题
  5. Your anti-virus program might be impacting your build perfor
  6. 查看 apk 的信息
  7. Android编译系统(Android.mk文件详解-仅供参考)
  8. Ubuntu下编译AOSP步骤
  9. Android(安卓)Studio FFMPEG 入门

随机推荐

  1. Android中使用Gesture加入手势操作
  2. android Bitmap类方法属性 详细说明
  3. android 调用系统自带的设置时间日期对话
  4. 【Android(安卓)开发教程】触发事件
  5. Android(安卓)命令行编译、打包生成apk文
  6. 从头学Android之多媒体--使用MediaRecord
  7. Android(安卓)studio进行单元测试
  8. [无线] AndroidManifest.xml配置文件详解
  9. 在Ubuntu16.04下编译FFmpeg4.2.3
  10. android下对存储的操作