【发布时间】:2015-08-31 14:30:26
【问题描述】:
我正在尝试根据here 的说明创建一个运行 TexturePacker 的 gradle 任务。 (请注意,我使用的是 Android Studio 及其目录结构,而不是 Eclipse。)我首先将以下内容添加到 Android Studio 项目的build.gradle:
import com.badlogic.gdx.tools.texturepacker.TexturePacker
task texturePacker << {
if (project.ext.has('texturePacker')) {
logger.info "Calling TexturePacker: "+texturePacker
TexturePacker.process(texturePacker[0], texturePacker[1], texturePacker[2])
}
}
这给出了错误
无法解析 com.badlogic.gdx.tools.texturepacker.TexturePacker 类
在桌面项目中将texturePacker 任务移动到build.gradle 会产生同样的错误。根据http://www.reddit.com/r/libgdx/comments/2fx3vf/could_not_find_or_load_main_class_texturepacker2/,我还需要将compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"添加到桌面项目的依赖项下的根build.gradle。当我这样做时,我仍然得到同样的错误。
所以我有几个问题:
texturePacker任务的正确位置在哪里?我应该把这个放在哪个build.gradle?如何解决依赖问题和
unable to resolve class...错误?使用 gradle 运行时如何指定输入和输出目录以及 atlas 文件? (假设前两个问题已经解决。)
【问题讨论】:
标签: android libgdx texturepacker