Android Studio inline compiler showing red errors, but compilation with gradle works fine Ask Question

Android Studio inline compiler showing red errors, but compilation with gradle works fine Ask Question

I've set up my project in Android Studio to use the Square Wire library, as per this question.

Build -> Compile Project works fine.

2:03:10 PM Compilation completed successfully in 31 sec

However, if I open one of my generated Protocol Buffer files, then the Square package is not being recognized.

Android Studio インラインコンパイルエラー

Another symptom is that methods inherited from the Square Message class are showing as "Cannot resolve method" compile errors in the editor, even though they build and run fine.

Android Studio の 1 行コンパイル エラー

Do I need to do something more than just adding the dependency in build.gradle for my module in my project?

ベストアンサー1

The following steps helps

  1. Close your project, and in your project folder delete project/.idea
  2. Delete ~/.gradle folder.

Open the project again. Everything should be solved.

おすすめ記事