无法将 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 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

相关文档推荐

Show padding zeros using DecimalFormat(使用 DecimalFormat 显示填充零)
Java decimal formatting using String.format?(使用 String.format 的 Java 十进制格式?)
Sprintf equivalent in Java(Java 中的 Sprintf 等价物)
StAX XML formatting in Java(Java 中的 StAX XML 格式)
Java - format double value as dollar amount(Java - 将双值格式化为美元金额)
Java printf using variable field size?(Java printf使用可变字段大小?)