Cannot resolve symbol 'google' on import com.google

Answered

On my code I have to import this: com.google.common.base.Preconditions.checkState, the IDE says: Cannot resolve symbol 'google' and in some forums users says that the solution is modify the pom.xml but I don't find it, what can I do to resolve that error ?

0
6 comments

Is it a Maven or Gradle based project? Can you build it (Build | Build Project action) in IDE?

Try File | Invalidate Caches/Restart.. | Invalidate and Restart.

If it is Maven/Gradle project, try to reimport it in IDE (File | New | Project from Existing Sources... and select Maven pom.xml or Gradle build.gradle file).

1
Avatar
Permanently deleted user

Hi,

I have similar problem. I have added com.google.gson to the pom.xml. I can use gson classes in the IDE, I can build the project using action Build | Build Project, but while I try to compile project by Maven -clean -install, I have got error

[ERROR] import com.google.gson.Gson;
[ERROR] The import com.google cannot be resolved

I tried to invalidate cahces and restart, it doesnt help. Do you have any idea how to solve that?

 

0

Double check the correct dependencies are specified in pom.xml. Check that the maven is able to download them from the remote repository.

0
Avatar
Permanently deleted user

Поменял Android studio на ваше творение, уже целый день мучаюсь с установкой((

Нужно в консольное приложение добавить библиотеку import com.google.Gson... Не думал что такие проблемы будлут!

Как это сделать? Где лежит pom.xml?

0
Avatar
Permanently deleted user

А вот еще, совсем непонятная вещь, запускаю, а он мне

Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main

0

Hello,

pom.xml is located under project root. 

> Error: Could not find or load main class Main

Looks like some issue with class path. Is it possible to share sample project example for investigation?

0

Please sign in to leave a comment.