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
import com.google.common.base.Strings;
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,
com.google.guava
package following the instruction in documentation -- I picked com.google.guava:guava-base:r03
to downloadcom.google.guava
package in the project settings. See the documentation instruction "Configuring Module Dependencies and Libraries".
Not sure if understood well but importing gradle project into IntelliJ works pretty fine - using of gradle wrapper is recommended.
doesn't this pretty much negate the whole point of using gradle?
This link solved the same problelm i was having jetbrains.com/idea/help/…
This was the only solution/description that worked for me (IntelliJ 14.1.2): stackoverflow.com/a/31195053/2584278