Reputation: 3897
Android studio is failing to suggest imports for known classes, like Date and List and so on. Just warns "Cannot resolve symbol"
Android Studio 2.2.3
Build #AI-145.3537739, built on December 2, 2016
JRE: 1.8.0_76-release-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Note: Auto import is enabled, and there are no excluded classes from it, manually adding the import statement works.
Upvotes: 2
Views: 2977
Reputation: 921
Invalidating caches didn't work for me.
What I found working was to tick the "Scope analysis to the current package" in the Dart Analysis.
Upvotes: 1
Reputation: 352
It should automatically import (atleast in 2.2.2).Try this if it does not,
Select the red coloured text ( the symbols which can't be resolved) and press Ctrl+i
. This will import the required.
If this does not work go to File-> Invalidate caches/Restart.
Auto import not working for Android classes in Android studio
Upvotes: 11