1. 程式人生 > >Android Studio 2.3.3 32位 win7 cmake的配置

Android Studio 2.3.3 32位 win7 cmake的配置

在Android Studio中,CMake是可以直接通過SDK Manager下載的,但是在Android Studio 32位裡就只能自己下載了。我從CMake官網獲取了一份最新的CMake,放到報錯提示的位置下,遇到了錯誤:
CMake Error: Could not create named generator Android Gradle - Ninja
通過查詢資料,確定了Android使用的CMake必須是Google提供的,因此通過騰訊的Bugly映象獲取到了Android需要使用的CMake,下載地址:
http://a62f762da201.repository.bugly.qq.com/android/repository/cmake-3.6.3155560-windows-x86_64.zip

解壓後發現多了ninja.exe檔案,所以需要編譯32位的。下載ninja 原始碼:

https://github.com/ninja-build/ninja/releases

vs編譯ninja 如下:

Building on Windows

First of all cygwin builds are NOT supported and will not be supported by android-cmake. To build natively on Windows you need a port of make but I recommend http://martine.github.io/ninja/ instead.(網址打不開了)

To build with Ninja you need:
Ensure you are using CMake newer than 2.8.9;
Download the latest Ninja from https://github.com/martine/ninja/releases;
Put the ninja.exe into your PATH (or add path to ninja.exe to your PATH environment variable);
Pass -GNinja to cmake alongside with other arguments (or choose Ninja generator in cmake-gui).
Enjoy the fast native multithreaded build :)

根據編譯介紹,需要安裝python2.7,vs命令列中編譯

將ninja.exe拷貝到cmake\bin目錄下。將bin目錄新增到變數中。在cmd中輸入ninja --version,檢視是否安裝正確。

32位的android studio  使用cmake的問題還是沒有解決,編譯引數cmake -GAndroid Gradle - Ninja  還是報錯,如果有解決問題的能否告知我呢,謝謝。