A
A
Andrey Andryushchenko2015-05-05 05:34:58
Java
Andrey Andryushchenko, 2015-05-05 05:34:58

How to enable gson via gradle?

I have a gradle project created with the libGDX jar specifically for IntelliJ IDEA. There are three modules: core, android, desktop. I need to connect the gson library to the core module. I tried to write the line
compile "com.google.code.gson:gson:2.+"
Errors in the dependencies, but the environment does not see the classes included in this library. How to properly connect libraries via gradle to projects of this type?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Andryushchenko, 2015-05-05
@delphikettle

First, you need to upgrade the environment to the 14th version.
Secondly, we need to ensure that the project is perceived by the environment as a gradle project. To do this, we close the project, delete *.iml, *.ipr, *.iws files from the project directory and its folders, as well as folders with the names .idea, .gradle, build. Then we open the project in the environment through the File-> Open item, select the build.gradle file in the root of the project. It opens, open the window for working with the gradle project, click the update button and voila, all the libraries are loaded, we work with the library as it should.

O
one pavel, 2015-05-05
@onepavel

I wrote libs in the gradle file not of the core itself, but in the gradle of the entire project.
It looked like this:

project(":core") {
    apply plugin: "java"
    dependencies {
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question