문제

Whenever I try to use Gdx.files.internal to get a FileHandle, I am getting a FileNotFoundException like follows:

    <PATH TO MY GAME>\desktop\xml\screen.xml (The system cannot find the path specified)

I set my project up using the libgdx project setup tool, and it seems that my asset folder within my desktop project is the same as my android project (they're linked). However, when I go to my desktop project there is a bin folder with my assets. If I change the path to "/bin/..." then I can run the project without any exceptions. However, I feel this may be a problem if I export as a JAR.

Code:

    final FileHandle screenXML = Gdx.files.internal("xml/screen.xml");

files

도움이 되었습니까?

해결책

My problem stemmed from the following (credit goes to the awesome and patient IRC community members for Libgdx):

    // final Document screenDoc = docBuilder.parse(screenXML.file());
    // Note: MUST use .read() here, not .file(), as we link from the android assets!
    final Document screenDoc = docBuilder.parse(screenXML.read());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top