Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The import com.badlogic cannot be resolved in Java Project Libgdx Setup

I've just tried to setup Libgdx to start making games, i followed this tutorial https://www.youtube.com/watch?v=S9fs1PVTyUc&feature=youtu.be in conjunction with the libgdx grdale setup. However an error shows up in the Java project which says:

The import com.badlogic cannot be resolved

I am using Eclipse for Java IDE. I believe I have the Android SDK installed. I think it may be to do with the setup but i think the latest updates are there and i tried deleting '.m2'ccahe, which is not there any more btw after i deleted it (not been replaced), but this didnt work. Any ideas?

heres my code for the java proect:

import com.badlogic.gmx.Game;

public class GameMain extends Game{

}//'com.badlogic 'gets an error and so does 'Game'

enter image description here

like image 867
user3165683 Avatar asked Sep 25 '26 15:09

user3165683


1 Answers

The issue you are encountering is your eclipse project "CreateGame" is not setup correctly. It is missing the files needed to use libgdx.

Possible Solutions:

  • Use the libgdx project setup tool and then follow the instructions here to import the project to eclipse. (easy)
  • Add the missing library files to the project (hard)

Also make sure your game code is going into the game-core project as this project is used by each platform you are targeting.

like image 99
Jyro117 Avatar answered Sep 28 '26 03:09

Jyro117