Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio 3 c++ file full of errors but compilation is ok

I am using Android studio 3 to develop Android application that contains c++ code that are compiled using cmake and NDK, the compilation is ok and the app runs correctly, but when I try to edit cpp file, the inline compiler shows a lot of errors, all standard header files are missing, this is very annoying as I cannot know if I make any compilation error until I run the app, I am not using any special configuration in cmake or in cradle file, any suggestion to fix the problem?

like image 796
ammcom Avatar asked Mar 23 '18 23:03

ammcom


2 Answers

CLion (the C++ IDE that Android Studio is based on) does not have a perfect C++ parser. I believe there's a fix for the most common issue (not properly handling SFINAE) coming Soon.

like image 195
Dan Albert Avatar answered Sep 28 '22 01:09

Dan Albert


Found a solution:

  1. Close Android Studio
  2. In command-line, delete the .idea folder in your project's root folder.
  3. Open Android Studio, invalidate caches and restart.
  4. Open AS again, sync gradle.

If the above steps don't work, try setting your gradle version to 3.3 (if it's not that already), and try the above steps again.

like image 35
Gil Moshayof Avatar answered Sep 28 '22 02:09

Gil Moshayof