Reputation: 1054
I am doing a project in Android Studio and today I saw that suddenly all my code has errors and even the line:
import com.google.android.gms.appindexing.Action;
has error: cannot resolve symbol android
any suggestions why this might have happened?
Upvotes: 1
Views: 7705
Reputation: 450
What I did: in Android Studio Settings --> Build, Execution, Deployment Build Tools --> Gradle I had set the value of the field Gradle User Home.
I did that, because it was displaying a wrong path (perhaps from an earlier installation?) But what I put in was really a guess.
But it caused several problems, including a thousand warnings "cannot resolve symbol 'android'"
I fixed it by emptying the field (then Clean Project, then in Terminal ./gradlew clean
, then File --> Invalidate Caches... because ... who knows? does anybody really know?)
Upvotes: 0
Reputation: 1
solved this issue by -> clean project - > save all - > close all tabs -> Close entire project -> Reopen it again.
The issue solved
Upvotes: 0
Reputation: 4191
Please try as follows
or
Upvotes: 0
Reputation: 1596
1st update your SDKs ( Android tools SDK & Google play service)
in your build.gradle "modules" include this code in your dependencies
compile 'com.google.android.gms:play-services-places:<version>
where is the latest version available...my version at the time of this answer is 11.0.4
Upvotes: 0
Reputation: 2523
Please ensure you have mention in your project grades it has been tested and working fine
dependencies {
...
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
...
}
clean your project and rebuild again and wait till android studio make indexing and loaded all resource some time due to system it will slow. please comment if you found something else. happy coding :)
Upvotes: 2