添加 gxd-tools.jar 作为核心库后,我在 IntelliJ 中构建 Core/Desktop/Android 项目时遇到问题。
请注意我的导入:
package com.enplug.exampleapp;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.enplug.common.logging.ILog;
import com.enplug.sdk.hosting.AppState;
import com.enplug.sdk.hosting.HostedGame;
import com.enplug.sdk.interfaces.FontType;
import com.enplug.sdk.interfaces.IServiceProvider;
import com.enplug.sdk.model.social.SocialFeedDefinition;
import com.badlogic.gdx.graphics.g2d.freetype.*;
import com.badlogic.gdx.tools.imagepacker.TexturePacker2;
和TexturePacker代码:
TexturePacker2.process("C:\\pokusatlas", "C:\\pokusatlas", "spritesheet");
我的错误截图:
我应该怎样做才能避免这个错误?
最佳答案
查看有关 adding libgdx tools to the gradle dependencies 的指南。让我引用重要的部分:
Tools Gradle
Core Dependency:
Dont put me in core!
==> 你不应该将 gdx 工具添加到核心项目中!将其放入桌面项目中:
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
将 libgdx-tools 添加到核心项目的问题是 libgdx-tools 与 android/ios 项目不兼容。但是android/ios依赖于核心项目,所以你不能将平台相关的库添加到你的核心项目中。
但即使可以包含在核心项目中,这也不是一个好主意。我的意思是你无论如何都不会在你发布的应用程序中运行TexturePacker。只需在开发过程中运行TexturePacker并将其输出包含在您的android Assets 文件夹中。
关于java - LibGdx 工具错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26162323/