I\'ve set up my project in Android Studio to use the Square Wire library, as per this question.
Build
-> Compile Project
works fine.
I was still having the same problem with Android Studio v3.2.1 constantly, and sorted out the problem just removing these two sub-folders of the .idea
folder (no need to delete the whole .idea
folder) while a gradle sync didn't work:
./idea/caches
./idea/libraries
if File -> Invalidate caches/Restart -> Invalidate and Restart is Not Working then follow few step.
1.) Close Your Android Studio
2.) Then Delete Manual on C:\Users\Balbir\ .AndroidStudio4.0\system\caches Folder.
3.) Start Android Studio
It is Work For Me.
If all above answers don't work for you. Just try update your dependencies to latest version. It worked for me.
I got the same issue cleared using the following steps:
update the library version in gradle to any random number, eg: lib_1.0.0 -> lib_1.0.0.0
gradle sync
sync shows error
revert the version change lib_1.0.0.0 -> lib_1.0.0
gradle sync
Open the java file with imports to see the error cleared.
I had this problem after upgrading to Android Studio 3.1. I solved the issue by upgrading all the components I use. So I changed the following entries in my build.gradle (app):
Upgrade SDK (from "compileSdkVersion 25" to "compileSdkVersion 26" or maybe higher when you read this note):
//compileSdkVersion 25
compileSdkVersion 26
Comment: This change forced program to download/install new sdk during next sync.
Upgrade appcompat-v7:
//implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
Upgrade firebase:
//implementation 'com.google.firebase:firebase-ads:11.4.2'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-ads:12.0.1'
In PROJECT build.gradle, upgrade google-services:
//classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
Upgrade gradle (from 4.4 to 4.6). From gradle-wrapper.properties: distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
After these changes, clean project, invalidate cache/restart, remove .idea/libraries content and resync (not sure about the order but ALL these activities solved the issue for me).
Deleting libraries folder in .idea solved the issue for me. It is located in project's root/.idea/libraries.
I'm using Android Studio 3.1.4