Android Studio issue cmake

Viewed 1699

I have issue like this, when I want to rebuild my project.

Cause: executing external native build for cmake /home/hovsep/Documents/GITLAB/moon/Android/branches/Dev-Main/app/CMakeLists.txt

how can I fix it.

2 Answers

The error text you see is "top level". There may be anything behind it.

Need to look into log files like:

./app/.cxx/cmake/commonDebug/x86/android_gradle_generate_cmake_ninja_json_x86.stderr.txt

Do not know how to find all logs. I searched it in linux with:

find -mmin -1

That helped me to find the real issue in correspondent log files.

This could be due to one of two problems.

  1. You also need to install ncurses5 as Android Studio doesn't support later versions, you may not have it or you may have a later version installed on your computer.

To reinstall ncurses5 open terminal in Ubuntu and type:

sudo apt install --reinstall libncurses5-dev

To install ncurses5 open terminal in Ubuntu and type :

sudo apt-get install libncurses5-dev

OR

  1. The problem is the wrong location of CMakelist.txt file.

Try to move CMakelist.txt file from your app root directory to app/src/main/cpp/CMakelist.txt directory and then update the location from gradle file also like this:

externalNativeBuild {
cmake {
    path "src/main/cpp/CMakeLists.txt"
      }
}

Otherwise IDK sorry.

Related