質問

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