Stephan Celis
Stephan Celis

Reputation: 2612

cannnot resolve symbol Calendar (Google calendar api in Java)

Creating a Java application for Google Appengine that needs to use Google Calendar api.

I'm following the example https://developers.google.com/google-apps/calendar/quickstart/java

I've added the dependecies in the correct build.gradle file as stated in the example I even tried to force redownload the dependencies using gradle build --refresh-dependencies

But where I try to import the classes, I get the error

'cannot resolve symbol calendar'

Where I do the import statements

import com.google.api.services.calendar.CalendarScopes;
import com.google.api.services.calendar.model.*;

Was there a change without an update of the example? Wrong dependency?

Also when I alt+enter in IntelliJ on the lines that need the import, I don't get a suggestion what the correct import should be. Only the default create class stuff, which suggests it can't find the correct import to begin with.

UPDATE: I updated the dependency line to a newer version:

compile 'com.google.apis:google-api-services-calendar:v3-rev145-1.20.0'

instead of the one from example:

compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'

=> No change in behaviour

Upvotes: 1

Views: 1170

Answers (1)

konqi
konqi

Reputation: 5227

If you can build your project with gradle it is likely that IntelliJ is just not aware of the gradle nature / dependencies.

Try to make IntelliJ understand that you're using Gradle by:

  • Delete all IntelliJ project files and open the project by selecting the gradle file.
  • Go to View => Tool Windows -> gradle. In in the gradle screen press refresh all gradle projects and it should resolve

Upvotes: 2

Related Questions