Search code examples
androidintellij-ideagradlelibgdxtexturepacker

Adding libgdx extensions to IntelliJ


Everybody!

I'm a newb in game development. And I'm following the tutorial in "Learning Libgdx Game Development" to create cross-platform 2D games. However, I'm using IntelliJ instead of Eclipse because IntelliJ seems like to help me out with my coding style.

My problem is: When I import a libgdx project to IntelliJ (using "gdx-setup"), everything works fine. Until I need an extension of libgdx called TexturePacker in "extensions/gdx-tools". I think I can add this .jar file as a normal library but it does not work.

Here is the errors I have got:

  • Error:(5, 44) Gradle: error: package com.badlogic.gdx.tools.texturepacker does not exist

I will appreciate your help. Thanks!


Solution

  • Since your libgdx project is now built with gradle you will have to add the tools extension as a gradle dependency of your desktop project:

    compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
    

    otherwise gradle won't compile (..and find) it.

    This is explained in more detail at the libgdx project page

    BTW: While setting up your project with the gdx-setup jar you can check the "tools" checkbox and it will generate a project that already has the tools dependency in the build.gradle file.