Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google GSON Dependency not found

I am trying to have GSON in my pom.xml but IntelliJ is telling me that the dependency "com.google.code.gson:gson:2.8.0" not found. I have tried calling the Maven repository but it still is not working. Also ignore the commented out lines.

Here is a copy of my pom file.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>TagChooser</groupId>
<artifactId>TagChooser 1.7.10</artifactId>
<version>1.0-SNAPSHOT</version>


<dependencies>

    <!--  Gson: Java to Json conversion -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.0</version>
        <scope>compile</scope>
    </dependency>

    <!--<dependency>-->
        <!--<groupId>mkremins</groupId>-->
        <!--<artifactId>fanciful</artifactId>-->
        <!--<version>0.4.0-SNAPSHOT</version>-->
    <!--</dependency>-->

</dependencies>

<repositories>
    <repository>
        <id>central</id>
        <name>Maven repository</name>
        <url>http://repo1.maven.org/maven2</url>
    </repository>

    <!--<repository>-->
        <!--<id>stealthyone-repo</id>-->
        <!--<url>http://repo.stealthyone.com/content/groups/public</url>-->
    <!--</repository>-->

</repositories>

like image 370
Austin McCalley Avatar asked Jul 12 '26 05:07

Austin McCalley


2 Answers

I remembered how to do this really quickly. You have to go to File -> Project Structure. Then click the Libraries tab and the green plus. Once clicked select from Maven and then search GSON and find the correct GSON version you want to use from the menu and then GSON dependency will work.

like image 114
Austin McCalley Avatar answered Jul 13 '26 18:07

Austin McCalley


I had the same issue.

Go to File -> Invalidate Caches/ Restart and click the same again.

Android Studio restarts and reloads all your library files.

like image 39
Chris8447 Avatar answered Jul 13 '26 18:07

Chris8447



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!