Skip to content

Java project with Gradle in IntelliJ IDEA: cannot resolve symbol ‘google’ but project compiles

I have a toy Java project set up with Gradle in IntelliJ IDEA 13.1.2. It compiles and runs fine, but the IDE highlights ‘google’ in


as red and warns “Cannot resolve symbol ‘google'”. Any idea how to fix it?

I have tried 1) deleting .idea/ and re-creating the project in IntelliJ IDEA, and 2) re-importing project from the manually created Gradle configuration file build.gradle, but to no avail.


It turns out that the depended packages need to be separately specified in IntelliJ IDEA in addition to build.gradle and explicitly added as a dependency. Namely,

  1. download the package following the instruction in documentation — I picked to download
  2. follow the automatically-prompted window to add it as a project library to the Java project.
  3. Specify that the Java module depends on the package in the project settings. See the documentation instruction “Configuring Module Dependencies and Libraries”.