gpt4 book ai didi

java - 使用Gradle为LibGDX添加工具依赖项时出现问题

转载 作者:行者123 更新时间:2023-12-03 06:04:35 26 4
gpt4 key购买 nike

我将继续学习Learn LibGDX Game Developer 2nd Edition。我正在使用Eclipse。我们正在为台式机(Android和所有已禁用)开发游戏。我们也使用了Gradle。我来到这一段...

For Gradle users, adding gdx-tools is easy; we just need to add the following highlighted line to the build.gradle file in C:/libgdx:


project(":desktop") {
...
compile "com.badlogic.gdx:gdx-tools:$gdxVersion"

Make sure that you are editing under the section project(":desktop"). After editing, we need to refresh our dependencies. To do this, right-click on the CanyonBunny-desktop project and go to the Refresh All option in the Gradle menu. Make sure that you are connected to the Internet because Eclipse will download the relevant dependencies.



我在project(“:desktop”)方法下的build.gradle如下...
project(":desktop") {
apply plugin: "java"

dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
compile "com.badlogic.gdx:gdx-tools:$gdxVersion"
}
}

我还刚刚构建了一个虚拟的LibGDX项目,并启用了工具,以确保将代码添加到了正确的部分。

之后,我通过右键单击我的依赖项Gradle(STS)->全部刷新来刷新gradle。

现在,当我从我以为是我添加的工具依赖项中添加一些导入时,我的运行器类找不到它。
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
import com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings;

有什么帮助吗?如果您需要更多信息,请告诉我,我尝试尽可能地详细!

最佳答案

这本书有错字,应该是...

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

关于java - 使用Gradle为LibGDX添加工具依赖项时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39520933/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com