无法将 gdx-tools 添加到 libgdx gradle 项目

Can#39;t add gdx-tools to libgdx gradle project(无法将 gdx-tools 添加到 libgdx gradle 项目)
本文介绍了无法将 gdx-tools 添加到 libgdx gradle 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我是 Gradle 的新手.我正在尝试将 gdx-tools 添加到我的项目中:

I'm new in Gradle. I'm trying to add gdx-tools to my project:

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-tools:$gdxVersion"
    }
}

我打开我的桌面项目,文件夹Gradle Dependecies"并看到gdx-tools-1.0.1.jar".当我尝试打开它时 - 没有显示.

I open my Desktop project, folder "Gradle Dependecies" and see "gdx-tools-1.0.1.jar". As I try to open it - nothing shows.

所以,当我尝试使用它时(我想尝试将图像打包到图集) - 我无法导入 com.badlogic.gdx.tools...

So, when I try to use it ( I want to try pack images to atlas) - I can't import com.badlogic.gdx.tools...

我做错了什么?

推荐答案

我也遇到了同样的问题.所以我把com.badlogicgames.gdx:gdx-tools:1.9.2"放到我的浏览器中,看看它把我带到了哪里.(1.9.2 是我的 gdxVersion)果然没有把我带到一个页面,而是一个搜索结果.我跟着第一个:

I had the same problem. So I put "com.badlogicgames.gdx:gdx-tools:1.9.2" into my browser to see where it took me. (1.9.2 being my gdxVersion) Sure enough it did not take me to a page but to a search result. I followed the first one:

http://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-tools/1.5.2

其中说有一个新版本 - 1.9.2(嗯,呃 - 这就是我想要达到的.谢天谢地,有一个链接,我关注它.)

Which says there is a new version - 1.9.2 (well, duh - that's what I'm trying to reach. Thankfully, there's a link and I follow it.)

http://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-tools/1.9.2

现在,在页面的中上部,您会看到一个标签框,中间有代码.选择 Gradle 并复制该代码.

Now, in the upper center of the page you'll see a tabbed box with code in the middle. Select Gradle and copy that code.

回到你的 Gradle 文件中添加:

Back in your Gradle file add:

编译(粘贴)

或者,在我的特殊情况下:

Or, in my particular case:

compile 'com.badlogicgames.gdx:gdx-tools:1.9.2'

现在点击同步.这行得通,但我担心硬编码 gdxVersion 号码,所以我玩了一下.如果您将 1.9.2 替换为 $gdxVersion 并将单引号 (') 替换为双引号 (") 它应该同步.所以现在我的 Gradle 行如下所示:

Now hit sync. This worked but I was worried about hard coding the gdxVersion number so I played around. If you replace the 1.9.2 with $gdxVersion and the single quotes (') with double quotes (") it should sync. So now my Gradle line looks like this:

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

为什么?这似乎与我首先尝试的版本相同.我不知道.但这些是导致我成功同步的步骤.

Why? This seems identical to the version I tried first. I don't know. But these are the steps that led to a successful sync for me.

这篇关于无法将 gdx-tools 添加到 libgdx gradle 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)