The project compiles fine. However, Android studio 3.0.1 shows reference to one particular library in red and displays \"cannot resolve symbol\". Even single stepping into
In my case changing the Gradle version worked.
In gradle-wrapper.properties
changing
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
and in build.gradle (project level)
changing
classpath 'com.android.tools.build:gradle:3.3.0'
to
classpath 'com.android.tools.build:gradle:3.2.1'
Firsty try to Clean and rebuild project from Build -> Clean project & then Build -> Rebuild project.
If that doesn't work Invalidate Caches/Restart always works for me. Do it from File -> invalidate Caches/Restart
Then click on invalidate and restart
Hopefully this helps.
Invalidate cache/restart didn't work for me.
Simple and working solution:
1: Remove all dependencies from App level Gradle and Sync.
2: Re-add all these dependencies and Sync.
It will work fine.
This is happen to me when I move my project to other pc or open the project with other pc and with different SDK folder location. Solution: close project, delete folder .gradle and folder .idea inside project folder then open your project to sync gradle.
I tried Invalidate cache/restart
or clean Project -> rebuild project
. These didn't work for me.
The final solution was open Project window on the left side of IDE, under Project mode, delete .gradle
and .idea
folder, then sync, it works.
I Tried the following in order to resolve the issue:
Non of these tries helped to resolved this issue. Finaly I have tried these two steps:
commented dataBinding.enabled true from build.gredle of your app as its obsolete and replaced with buildFeatures{dataBinding true}.
Deleted the content of the log, tmp and caches folder from the installed path manually. Eg. {installed path}.AndroidStudio4.0\system\caches, {installed path}.AndroidStudio4.0\system\log, {installed path}.AndroidStudio4.0\system\log
Restarted the android studio
Now all reference for the Binding and other classes were restored.