我正在尝试根据此处的说明创建一个运行 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 文件?(假设前两个问题已解决。)