Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could not get version from cmake.dir

when I build syc my android project it comes like this enter image description here

enter image description here

local.properties

enter image description here

How can I solve this error?

like image 402
Pradeep Simba Avatar asked Nov 22 '25 14:11

Pradeep Simba


2 Answers

You may want to specify the cmake version in your build.gradle file thusly [1]

android {
    ...
    externalNativeBuild {
        cmake {
            ...
            // Specifies the version of CMake the Android plugin should use. You need to
            // include the path to the CMake binary of this version to your PATH
            // environmental variable.
            version "3.10.2.4988404"
        }
    }
}

For versions downloaded by the sdk manager, I didn't need to specify cmake.dir in my local.properties. Try deleting it entirely.

I needed to specify cmake.dir when I used a version of cmake that wasn't installed from Android Studio's sdk manager. Then I had to put the path to the cmake installation directory (the one containing the bin/cmake), not the cmake binary directory directly.

[1] Snippet is copied from https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/Cmake#version

like image 145
xaviersjs Avatar answered Nov 25 '25 06:11

xaviersjs


For me, I am using the newest version of CMAKE from the source repo. It by default installs to /usr/local/bin/cmake.

The problem is that the error message never says that it is adding /bin/cmake to the path...

so for the future in your local.properties make like so:

cmake.dir=/usr/local/
like image 43
LUser Avatar answered Nov 25 '25 05:11

LUser