libgdx: The declared package does not match the expected package “”

你离开我真会死。 提交于 2019-12-12 04:07:23

问题


I'm working with LibGdx and Eclipse, I used the latest version and the setup tool that creates the project for Android, desktop and another one named "core", I imported in Eclipse, but I keep getting this error in both desktop and android projects:

The declared package "com.mygdx" does not match the expected package ""

Could you help me out please? Thanks in advanced!


回答1:


Just in case someone might find it useful, the actual problem was to add numbers in the project's name, that's why the package was splitted after com.mygdx, then the separate folders were created and gave me errors. I deleted this project, created another without numbers and that did the trick.

Thanks a lot for the help, still learning this libgdx + gradle!




回答2:


Right click on the src folder and select Build Path -> Use as Source Folder. Then restart Eclipse.

EDIT: right click project -> Properties -> java Build Path -> Source -> Add Folder -> select src/

Basically eclipse is not able to descend your package tree correctly. After this refresh the project try a clean build.



来源:https://stackoverflow.com/questions/24894698/libgdx-the-declared-package-does-not-match-the-expected-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!