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.
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.
Do I need to do something more than just adding the dependency in build.gradle
for my module in my project?
In my case, for some reason, Android Plugin Version wasn't set. I did try clearing cache and removing .gradle and .idea as well, but it didn't work out and after finally wandering for hours, I found this.
For me deleting .gradle and .idea folder of project solved the problem.
If all above answers don't work for you. Just try update your dependencies to latest version. It worked for me.
My hacky fix for this -
build.gradle
filedependencies{}
build.gradle
fileTried a lot of solutions and this was the only fix for me.
1) Click on the gradle icon (right side on the android studio)
2) Click on the refresh button and wait for the issue to be resolved :D
The following steps helps
project/.idea
~/.gradle
folder.Open the project again. Everything should be solved.