1

I copied an existing Android Studio project from another user and I can't compile C++ files using CMake because it uses the other user's CMake path

I already tried to delete and re-create the CMakeLists.txt file and re-installed CMake using SDK Manager

Here's my gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25

    defaultConfig {
        . . .

        externalNativeBuild {
            cmake {
                arguments '-DANDROID_TOOLCHAIN=clang'
            }
        }
    }
    buildTypes {
        release {
            . . .
        }
    }

    lintOptions {
        abortOnError false
    }

    externalNativeBuild {
        cmake {
            path file('CMakeLists.txt')
        }
    }

}

About 2 months ago, the project worked perfectly. Then I made some minor modifications and now I have this error. It's just like there's a way to indicate which CMake use, but I don't know where to find it.

Here's a resume of what the console show me when I want to clean the project:

Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Users/Old_User/Library/Android/sdk/cmake/3.6.4111459/bin/cmake'
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
    at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)

The rest of the error log is about the same message saying that it can find the cmake file

  • To change build directory (recently named `.cxx`), found correct solution in [another thread](https://stackoverflow.com/a/60492487/8740349) with example!! see [CMake docs](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/Cmake) and details. – Top-Master May 30 '21 at 03:37

1 Answers1

0

It appears that android build system is not able to find cmake utility. Please check if it is installed.

enter image description here

Ranjan Kumar
  • 1,164
  • 7
  • 12
  • I checked it and it's correctly installed. I noted that the error appears only during a clean of the project. If I build, it works! – Rafic Galli Apr 17 '19 at 07:25