Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
故障处理“;java/awt/font/NumericShaper.class“;_Java_Android_Android Studio_Libgdx - Fatal编程技术网

故障处理“;java/awt/font/NumericShaper.class“;

故障处理“;java/awt/font/NumericShaper.class“;,java,android,android-studio,libgdx,Java,Android,Android Studio,Libgdx,我最近开始使用androidstudioide开发一个使用LibGDX框架的项目,该框架使用Gradle。在我将一段代码拆分成一个新类之前,一切都运行得非常好。由于我已经这样做了,我不断得到以下错误: 处理“java/awt/font/NumericShaper.class”时出现问题: 核心类(java.*或javax.*)的错误用法 当不构建核心库时。 这通常是由于无意中包含了核心库文件 在应用程序的项目中,当使用IDE(例如 月食)。如果您确定您不是有意定义 核心类,那么这是对 继续。 然

我最近开始使用androidstudioide开发一个使用LibGDX框架的项目,该框架使用Gradle。在我将一段代码拆分成一个新类之前,一切都运行得非常好。由于我已经这样做了,我不断得到以下错误:

处理“java/awt/font/NumericShaper.class”时出现问题: 核心类(java.*或javax.*)的错误用法 当不构建核心库时。 这通常是由于无意中包含了核心库文件 在应用程序的项目中,当使用IDE(例如 月食)。如果您确定您不是有意定义 核心类,那么这是对 继续。 然而,实际上您可能正在尝试在核心中定义一个类 命名空间,例如,您可能已获取的源, 来自非Android虚拟机项目。这将是最重要的 肯定不行。至少,这会危害到整个社会 应用程序与平台未来版本的兼容性。 它的合法性也常常令人怀疑。 如果您真的打算构建一个核心库,那么 作为创建完整虚拟机的一部分适当 分发,而不是编译应用程序--然后使用 “--core library”选项以抑制此错误消息。 如果您继续使用“-core library”,但实际上 构建应用程序,然后预先警告您的应用程序 在某个时候仍然无法构建或运行。请 为愤怒的客户做好准备,例如,他们发现 一旦他们升级了操作系统,应用程序就会停止运行 系统。这个问题要怪你。 如果您合法地使用某个代码,而该代码恰好位于 核心包,那么最简单安全的选择就是 重新打包该代码。也就是说,将有问题的类移动到 您自己的包名称空间。这意味着他们将永远不会在这里 与核心系统类冲突。JarJar是一个可能有帮助的工具 在这项努力中,我将向你表示感谢。如果你发现你不能这样做,那么 这表明你所走的道路最终会改变 导致痛苦、痛苦、悲伤和哀叹

我尝试在这里搜索,但所有可能的解决方案要么不适合我,要么需要使用EclipseIDE。我现在被困了几个小时,无法理解为什么我的代码无法编译。我没有添加任何可能导致此错误的额外导入。这是我上过的最后一节课:

package com.infiniterain.infinitecrawler.states.floor;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.infiniterain.infinitecrawler.DisposablesHandler;
import com.infiniterain.infinitecrawler.states.Floor;

/*
Handles updating and rendering of the floor map.
*/

public class TileMap {
    // Floor fields
    private DisposablesHandler disposablesHandler;
    private Floor floor;

    // Textures
    private Texture tilesetTexture;
    private TextureRegion[] tileTexture;

    // Map properties
    private int[] floorSize;
    private int[] mapSize;

    // Tile properties
    private int[][] tileID;
    private int[][] tileRotation;

    // Constructor
    public TileMap(Floor floor) {
        // Floor fields
        this.floor = floor;
        disposablesHandler = floor.getDisposablesHandler();

        // Textures
        disposablesHandler.getTextures().put(
                "tilesetTexture",
                new Texture(floor.getFloorConfig().get("tilesetPath").asString()));
        tilesetTexture = (Texture) disposablesHandler.getTextures().get("tilesetTexture");
        tileTexture = new TextureRegion[tilesetTexture.getWidth() / 32 * tilesetTexture.getHeight() / 32];

        // Map properties
        floorSize = new int[]{
                floor.getFloorConfig().get("size").asIntArray()[0],
                floor.getFloorConfig().get("size").asIntArray()[1]};
        mapSize = new int[]{
                floorSize[0] * 10 + floorSize[0] - 1,
                floorSize[1] * 10 + floorSize[1] - 1};

        // Tile properties
        tileID = new int[mapSize[0]][mapSize[1]];
        tileRotation = new int[mapSize[0]][mapSize[1]];

        // Generating tile textures
        for (int x = 0, y = 0, count = 0; y < tilesetTexture.getHeight() / 32; y++, count++)
            for (x = 0; x < tilesetTexture.getWidth() / 32; x++, count++) {
                tileTexture[count] = new TextureRegion(tilesetTexture, x * 32, y * 32, 32, 32);
            }

        // Generating tilemap
        generateTilemap();
    }

    // Generates tilemap
    public void generateTilemap() {
        for (int x = 0; x < floorSize[0]; x++)
            for (int y = 0; y < floorSize[1]; y++) {
                tileID[x][y] = 0;
            }
        for (int dx = 0; dx < floorSize[0]; dx++)
            for (int dy = 0; dy < floorSize[1]; dy++) {
                // Building room
                for (int x = 0; x < 10; x++)
                    for (int y = 0; y < 10; y++) {
                        int cx = x + (dx * 10);
                        int cy = y + (dy * 10);
                        if (x == 0 && y == 0) {
                            tileID[cx][cy] = 0;
                            tileRotation[cx][cy] = 180;
                        } else if (x == 0 && y == 9) {
                            tileID[cx][cy] = 0;
                            tileRotation[cx][cy] = 90;
                        } else if (x == 9 && y == 0) {
                            tileID[cx][cy] = 0;
                            tileRotation[cx][cy] = 270;
                        } else if (x == 9 && y == 9) {
                            tileID[cx][cy] = 0;
                            tileRotation[cx][cy] = 0;
                        } else if ((y == 9) && (x != 0 && x != 9)) {
                            tileID[cx][cy] = 1;
                            tileRotation[cx][cy] = 0;
                        } else if ((x == 0) && (y != 0 && y != 9)) {
                            tileID[cx][cy] = 1;
                            tileRotation[cx][cy] = 90;
                        } else if ((x == 9) && (y != 0 && y != 9)) {
                            tileID[cx][cy] = 1;
                            tileRotation[cx][cy] = 270;
                        } else if ((y == 0) && (x != 0 && x != 9)) {
                            tileID[cx][cy] = 1;
                            tileRotation[cx][cy] = 180;
                        } else {
                            tileID[cx][cy] = 3;
                            tileRotation[cx][cy] = 0;
                        }
                    }
            }
    }

    // Renders the map
    public void render() {
        disposablesHandler.getSpriteBatch().begin();
        disposablesHandler.getSpriteBatch().setColor(1, 1, 1, 1);
        for (int x = 0; x < mapSize[0]; x++)
            for (int y = 0; y < mapSize[1]; y++) {
                disposablesHandler.getSpriteBatch().draw(tileTexture[tileID[x][y]], x * 32, y * 32);
            }
        disposablesHandler.getSpriteBatch().end();
    }
}
包com.infiniterain.infinitecrawler.states.floor;
导入com.badlogic.gdx.graphics.Texture;
导入com.badlogic.gdx.graphics.g2d.TextureRegion;
导入com.infiniterain.infinitecrawler.DisposablesHandler;
导入com.infiniterain.infinitecrawler.states.Floor;
/*
处理楼层地图的更新和渲染。
*/
公共类TileMap{
//场地
私人可处置商可处置商;
私人楼层;
//质地
私人纹理瓷砖;
私有纹理区域[]瓷砖纹理;
//地图属性
私人内部[]楼层化;
私有int[]映射大小;
//瓷砖特性
私有int[][]tileID;
私有int[]tileRotation;
//建造师
公共瓷砖地图(楼层){
//场地
这个地板=地板;
disposablesHandler=floor.getDisposablesHandler();
//质地
disposablesHandler.getTextures().put(
“tilesetTexture”,
新纹理(floor.getFloorConfig().get(“tilesetPath”).asString());
tilesetTexture=(纹理)disposablesHandler.getTextures().get(“tilesetTexture”);
tileTexture=new TextureRegion[tilesetTexture.getWidth()/32*tilesetTexture.getHeight()/32];
//地图属性
floorSize=新整数[]{
floor.getFloorConfig().get(“大小”).asIntArray()[0],
floor.getFloorConfig().get(“size”).asIntArray()[1]};
mapSize=new int[]{
floorSize[0]*10+floorSize[0]-1,
floorSize[1]*10+floorSize[1]-1};
//瓷砖特性
tileID=newint[mapSize[0][mapSize[1]];
tileRotation=new int[mapSize[0]][mapSize[1]];
//生成瓷砖纹理
对于(int x=0,y=0,count=0;ypackage com.infiniterain.infinitecrawler.states;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.JsonReader;
import com.badlogic.gdx.utils.JsonValue;
import com.infiniterain.infinitecrawler.DisposablesHandler;
import com.infiniterain.infinitecrawler.states.floor.Room;
import com.infiniterain.infinitecrawler.states.floor.TileMap;

import java.util.ArrayList;
import java.util.Random;

public class Floor extends State {
    // Floor properties
    private JsonValue floorConfig;
    private int floorID;
    private int[] floorSize;

    // Necessary objects
    private TileMap tileMap;
    private Room room[][];
    private DisposablesHandler disposablesHandler;
    private Random random;

    public Floor(GameStateManager gameStateManager, int floorID) {
        // Loading floors.json config
        floorConfig = new JsonReader().parse(
                Gdx.files.internal("configs/floors.json")).get(String.valueOf(floorID));

        // Setting floor properties
        this.floorID = floorID;
        floorSize = new int[]{
                floorConfig.get("size").asIntArray()[0],
                floorConfig.get("size").asIntArray()[1]};

        // Instantiating necessary objects
        disposablesHandler = new DisposablesHandler(true, false, false, true);
        random = new Random();

        // Generating the floor
        generateFloor(floorID);
        tileMap = new TileMap(this);
    }

    public void generateFloor(int floor) {
        int[] startingPoint = new int[]{
                random.nextInt(floorSize[0]),
                random.nextInt(floorSize[1])
        };

        room = new Room[floorSize[0]][floorSize[1]];
        for (int x = 0; x < floorSize[0]; x++)
        for (int y = 0; y < floorSize[1]; y++) {
            room[x][y] = new Room(new int[]{x, y});
        }

        room[startingPoint[0]][startingPoint[1]].setAccessible(true);
        room[startingPoint[0]][startingPoint[1]].setActivated(true);

        for (int x = -1; x < 2; x++)
        for (int y = -1; y < 2; y++) {
            if (x == 0 || y == 0)
            if (startingPoint[0] + x < floorSize[0] && startingPoint[1] + y < floorSize[2]
                    && startingPoint[0] + x >= 0 && startingPoint[1] + y >= 0) {
                room[startingPoint[0]][startingPoint[1]].setActivated(true);
                room[startingPoint[0] + x][startingPoint[1] + y].setParentPosition(new int[]{startingPoint[0], startingPoint[1]});
            }
        }


        while (true) {
            ArrayList<Room> activatedRooms = new ArrayList<Room>();
            for (int x = 0; x < floorSize[0]; x++)
            for (int y = 0; y < floorSize[1]; y++) {
                if (room[x][y].isActivated() && !room[x][y].isAccessible()) {
                    activatedRooms.add(room[x][y]);
                }
            }

            if (!activatedRooms.isEmpty()) {
                Room randomRoom = activatedRooms.get(random.nextInt(activatedRooms.size()));
                Room parentRoom = room[randomRoom.getParentPosition()[0]][randomRoom.getParentPosition()[1]];
                if (parentRoom.getPosition()[0] < randomRoom.getPosition()[0]) {
                    randomRoom.getDoor().remove("left");
                    randomRoom.getDoor().put("left", true);
                    parentRoom.getDoor().remove("right");
                    parentRoom.getDoor().put("right", true);
                } else if (parentRoom.getPosition()[0] > randomRoom.getPosition()[0]) {
                    randomRoom.getDoor().remove("right");
                    randomRoom.getDoor().put("right", true);
                    parentRoom.getDoor().remove("left");
                    parentRoom.getDoor().put("left", true);
                } else if (parentRoom.getPosition()[1] < randomRoom.getPosition()[1]) {
                    randomRoom.getDoor().remove("down");
                    randomRoom.getDoor().put("down", true);
                    parentRoom.getDoor().remove("up");
                    parentRoom.getDoor().put("up", true);
                } else if (parentRoom.getPosition()[1] > randomRoom.getPosition()[1]) {
                    randomRoom.getDoor().remove("up");
                    randomRoom.getDoor().put("up", true);
                    parentRoom.getDoor().remove("down");
                    parentRoom.getDoor().put("down", true);
                }
                randomRoom.setAccessible(true);

                int roomX = randomRoom.getPosition()[0];
                int roomY = randomRoom.getPosition()[1];
                for (int x = -1; x < 2; x++) {
                    for (int y = -1; y < 2; y++) {
                        if (x == 0 || y == 0)
                        if (roomX + x < floorSize[0] && roomY + y < floorSize[1]
                                && roomX + x >= 0 && roomY + y >= 0) {
                            room[roomX + x][roomY + y].setActivated(true);
                            room[roomX + x][roomY + y].setParentPosition(new int[]{roomX, roomY});
                        }
                    }
                }
            } else {
                break;
            }
        }
    }

    @Override
    public void handleInput() {
        if (Gdx.input.justTouched()) {
            //generateFloor(1);
           // System.out.println("touched");
        }
    }

    @Override
    public void update(float deltaTime) {

    }

    @Override
    public void render(DisposablesHandler disposables) {
        tileMap.render();
    }

    @Override
    public void dispose() {
        disposablesHandler.dispose();
    }

    // Getters
    public DisposablesHandler getDisposablesHandler() {
        return disposablesHandler;
    }

    public JsonValue getFloorConfig() {
        return floorConfig;
    }

    public int getFloor() {
        return floorID;
    }

    public int[] getFloorSize() {
        return floorSize;
    }
}