简体   繁体   English

libgdx:声明的软件包与预期的软件包“”不匹配

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

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: 我正在使用LibGdx和Eclipse,我使用的是最新版本和设置工具,该工具为Android,桌面和另一个名为“ core”的项目创建了项目,我在Eclipse中导入了该工具,但在台式机和android系统中我始终遇到此错误项目:

The declared package "com.mygdx" does not match the expected package "" 声明的软件包“ com.mygdx”与预期的软件包“”不匹配

在此处输入图片说明

Could you help me out please? 你能帮我一下吗? Thanks in advanced! 提前致谢!

Right click on the src folder and select Build Path -> Use as Source Folder. 右键单击src文件夹,然后选择Build Path-> Use as Source Folder。 Then restart Eclipse. 然后重新启动Eclipse。

EDIT: right click project -> Properties -> java Build Path -> Source -> Add Folder -> select src/ 编辑:右键单击项目->属性-> Java构建路径->源->添加文件夹->选择src /

Basically eclipse is not able to descend your package tree correctly. 基本上,eclipse无法正确地降低您的包树。 After this refresh the project try a clean build. 刷新项目后,尝试进行干净的构建。

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. 万一有人发现它有用,实际的问题是在项目名称中添加数字,这就是为什么在com.mygdx之后拆分包,然后创建单独的文件夹并给我错误的原因。 I deleted this project, created another without numbers and that did the trick. 我删除了这个项目,创建了另一个没有数字的项目,就成功了。

Thanks a lot for the help, still learning this libgdx + gradle! 非常感谢您的帮助,仍在学习此libgdx + gradle!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM