【问题标题】:LibGdx Tools ErrorLibGdx 工具错误
【发布时间】:2014-10-02 13:50:25
【问题描述】:

添加 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");

我的错误截图:

我应该怎么做才能避免这个错误?

【问题讨论】:

    标签: java intellij-idea opengl-es libgdx


    【解决方案1】:

    查看有关adding libgdx tools to the gradle dependencies 的指南。让我引用重要的部分:

    工具 Gradle

    核心依赖:

    不要把我放在核心!

    ==> 你不应该在核心项目中添加 gdx 工具!把它放在桌面项目中:

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

    将 libgdx-tools 添加到核心项目的问题是 libgdx-tools 与 android/ios 项目不兼容。但是android/ios依赖于核心项目,所以不能在核心项目中添加依赖平台的库。

    但即使可以包含在核心项目中,这也不是一个好主意。我的意思是你无论如何都不会在你发布的应用程序中运行 TexturePacker。只需在开发期间运行 TexturePacker 并将其输出包含在您的 android 资产文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-24
      • 2018-10-23
      • 1970-01-01
      相关资源
      最近更新 更多