Home » Android » gradle – Why Android Studio 3 use cmake 3.6.0 as default?

gradle – Why Android Studio 3 use cmake 3.6.0 as default?

Posted by: admin June 15, 2020 Leave a comment

Questions:

My Android studio is version 3.3.2 and i trying to link gradle to my native library, my module’s build.gradle is:

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        ndk {
            moduleName "MyModule"
            abiFilters 'x86', 'armeabi-v7a'
        }
    }

    externalNativeBuild {
        cmake {
            version "3.10.2"  // The key line
            path file('CMakeLists.txt')
        }
    }
}

If i don’t specify the cmake version to ‘3.10.2’, I am getting the following error:

CMake ‘3.6.0’ was not found in PATH or by cmake.dir property.
– CMake ‘3.10.2’ found in SDK did not match requested version ‘3.6.0’.
– CMake ‘3.12.1’ found in PATH did not match requested version ‘3.6.0’.
Install CMake 3.6.0

So I’am confused why is so! Why does it ask for the version of cmake itself to be 3.6.0.

Kindly review and give feedback.

How to&Answers:

Try to add the configuration below to your gradle:

   externalNativeBuild {
        cmake {
            version "3.10.2" // here
        }
    }