具體見上圖,主要三類
- cmake 找不到
- ndk找不到,更新as 3.5.3以後特有的,
- 安裝失敗
1 cmake找不到
報錯:
CMake Error: CMake was unable to find a build program corresponding to “Ninja”.
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添加到環境變量中,
- 工程中手工指定, cmake.dir =
2 ndk找不到
報錯:
NDK Resolution Outcome: Project settings: Gradle model version=4.4, NDK version is UNKNOWN
android studio版本3.5.3,gradle 4.4,gradle插件3.1.3。使用ndk.dir指定自己的ndk,或者用sdk manager中推薦的ndk版本都報上面的錯誤。。
解決方法:
升級gradle組件,
The problem is solved when I updated the Android Gradle Plugin Version from 3.1.4 to 3.4.0 and the Gradle Version from 4.4 to 5.1.1 at the same time. Of course, I downloaded the newest NDK(Side by Side) with SDK manager.
3 build ok,安裝報錯
錯誤信息:
Cause: buildOutput.apkData must not be null
解決方法:
檢查build Variants中的配置,諸如這種:
這裏得對齊:
- 很多主流型號的大屏手機都是arm64-v8a了,
- 車機比較舊是arme-v7a,
- android studio也推出了高性能的x86模擬器。
ref
https://stackoverflow.com/questions/57609738/ndk-resolution-outcome-project-settings-gradle-model-version-5-4-1-ndk-versio