LibGdx Error parsing file
I recently started a new game project through Android Studio and made a tilemap in a software called Tiled. However I keep getting this error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: assets/Desert.tmx
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:83)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:77)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:65)
at com.poptag.game.PopTag.create(PopTag.java:29)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assetsDesert.tmx (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
... 5 more
And here's code that loads and renders it:
@Override
public void create () {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false,w,h);
camera.update();
tiledMap = new TmxMapLoader().load("assets/Desert.tmx");
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
Gdx.input.setInputProcessor(this);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
tiledMapRenderer.setView(camera);
tiledMapRenderer.render();
}
I have put the map "Desert.tmx" and the tileset "tmw_desert_spacing.png" into the assets folder for both Android and Desktop. When I run the launcher for the Desktop, I receive these errors.
Here's the file tree
|
show 7 more comments
I recently started a new game project through Android Studio and made a tilemap in a software called Tiled. However I keep getting this error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: assets/Desert.tmx
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:83)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:77)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:65)
at com.poptag.game.PopTag.create(PopTag.java:29)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assetsDesert.tmx (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
... 5 more
And here's code that loads and renders it:
@Override
public void create () {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false,w,h);
camera.update();
tiledMap = new TmxMapLoader().load("assets/Desert.tmx");
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
Gdx.input.setInputProcessor(this);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
tiledMapRenderer.setView(camera);
tiledMapRenderer.render();
}
I have put the map "Desert.tmx" and the tileset "tmw_desert_spacing.png" into the assets folder for both Android and Desktop. When I run the launcher for the Desktop, I receive these errors.
Here's the file tree
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, theassets/portion is not part of the path as the internal files are relative to the assets directory.
– nEx.Software
Jun 27 '15 at 0:23
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26
|
show 7 more comments
I recently started a new game project through Android Studio and made a tilemap in a software called Tiled. However I keep getting this error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: assets/Desert.tmx
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:83)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:77)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:65)
at com.poptag.game.PopTag.create(PopTag.java:29)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assetsDesert.tmx (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
... 5 more
And here's code that loads and renders it:
@Override
public void create () {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false,w,h);
camera.update();
tiledMap = new TmxMapLoader().load("assets/Desert.tmx");
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
Gdx.input.setInputProcessor(this);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
tiledMapRenderer.setView(camera);
tiledMapRenderer.render();
}
I have put the map "Desert.tmx" and the tileset "tmw_desert_spacing.png" into the assets folder for both Android and Desktop. When I run the launcher for the Desktop, I receive these errors.
Here's the file tree
I recently started a new game project through Android Studio and made a tilemap in a software called Tiled. However I keep getting this error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: assets/Desert.tmx
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:83)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:77)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:65)
at com.poptag.game.PopTag.create(PopTag.java:29)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: assetsDesert.tmx (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
... 5 more
And here's code that loads and renders it:
@Override
public void create () {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false,w,h);
camera.update();
tiledMap = new TmxMapLoader().load("assets/Desert.tmx");
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
Gdx.input.setInputProcessor(this);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
tiledMapRenderer.setView(camera);
tiledMapRenderer.render();
}
I have put the map "Desert.tmx" and the tileset "tmw_desert_spacing.png" into the assets folder for both Android and Desktop. When I run the launcher for the Desktop, I receive these errors.
Here's the file tree
edited Jun 26 '15 at 20:50
Shuku
asked Jun 26 '15 at 19:24
ShukuShuku
217
217
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, theassets/portion is not part of the path as the internal files are relative to the assets directory.
– nEx.Software
Jun 27 '15 at 0:23
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26
|
show 7 more comments
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, theassets/portion is not part of the path as the internal files are relative to the assets directory.
– nEx.Software
Jun 27 '15 at 0:23
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, the
assets/ portion is not part of the path as the internal files are relative to the assets directory.– nEx.Software
Jun 27 '15 at 0:23
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, the
assets/ portion is not part of the path as the internal files are relative to the assets directory.– nEx.Software
Jun 27 '15 at 0:23
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26
|
show 7 more comments
3 Answers
3
active
oldest
votes
Well, I solved the problem. All I had to do was remake a map with Tiled and use a completely new tileset and it finally worked once I loaded the two files.
add a comment |
In your:
tiledMap = new Tmxblabla.load(assets/Desert.tmx)
Shouldnt you load your file called Tiled here?
Otherwise i see no need of you referring to this file since it is not called to in your code.
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
add a comment |
If you open the map .tmx file
then you get tag tileset firstgid="1" source="grass_and_water3.tsx"
which is pointing to tileset .tsx file, and even .tsx file pointing to combined tiles image i.e. .png file
In order to solve this problem just keep all file in same location i.e. under asset/ and provide same path in all files (.tmx, .tsx etc)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31080704%2flibgdx-error-parsing-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well, I solved the problem. All I had to do was remake a map with Tiled and use a completely new tileset and it finally worked once I loaded the two files.
add a comment |
Well, I solved the problem. All I had to do was remake a map with Tiled and use a completely new tileset and it finally worked once I loaded the two files.
add a comment |
Well, I solved the problem. All I had to do was remake a map with Tiled and use a completely new tileset and it finally worked once I loaded the two files.
Well, I solved the problem. All I had to do was remake a map with Tiled and use a completely new tileset and it finally worked once I loaded the two files.
answered Jul 1 '15 at 1:38
ShukuShuku
217
217
add a comment |
add a comment |
In your:
tiledMap = new Tmxblabla.load(assets/Desert.tmx)
Shouldnt you load your file called Tiled here?
Otherwise i see no need of you referring to this file since it is not called to in your code.
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
add a comment |
In your:
tiledMap = new Tmxblabla.load(assets/Desert.tmx)
Shouldnt you load your file called Tiled here?
Otherwise i see no need of you referring to this file since it is not called to in your code.
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
add a comment |
In your:
tiledMap = new Tmxblabla.load(assets/Desert.tmx)
Shouldnt you load your file called Tiled here?
Otherwise i see no need of you referring to this file since it is not called to in your code.
In your:
tiledMap = new Tmxblabla.load(assets/Desert.tmx)
Shouldnt you load your file called Tiled here?
Otherwise i see no need of you referring to this file since it is not called to in your code.
answered Jun 26 '15 at 19:33
snyggtsnyggt
96
96
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
add a comment |
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
Well, I'm not loading any files called Tiled. That was just a program that I used in order to create a 2D map. The file that I'm loading is the map called "Desert" which is a .tmx file located in the assets folder. However, Android Studio won't parse the file.
– Shuku
Jun 26 '15 at 19:44
add a comment |
If you open the map .tmx file
then you get tag tileset firstgid="1" source="grass_and_water3.tsx"
which is pointing to tileset .tsx file, and even .tsx file pointing to combined tiles image i.e. .png file
In order to solve this problem just keep all file in same location i.e. under asset/ and provide same path in all files (.tmx, .tsx etc)
add a comment |
If you open the map .tmx file
then you get tag tileset firstgid="1" source="grass_and_water3.tsx"
which is pointing to tileset .tsx file, and even .tsx file pointing to combined tiles image i.e. .png file
In order to solve this problem just keep all file in same location i.e. under asset/ and provide same path in all files (.tmx, .tsx etc)
add a comment |
If you open the map .tmx file
then you get tag tileset firstgid="1" source="grass_and_water3.tsx"
which is pointing to tileset .tsx file, and even .tsx file pointing to combined tiles image i.e. .png file
In order to solve this problem just keep all file in same location i.e. under asset/ and provide same path in all files (.tmx, .tsx etc)
If you open the map .tmx file
then you get tag tileset firstgid="1" source="grass_and_water3.tsx"
which is pointing to tileset .tsx file, and even .tsx file pointing to combined tiles image i.e. .png file
In order to solve this problem just keep all file in same location i.e. under asset/ and provide same path in all files (.tmx, .tsx etc)
edited Dec 29 '18 at 11:46
El.Ham
901520
901520
answered Dec 29 '18 at 10:08
Mayur LokareMayur Lokare
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31080704%2flibgdx-error-parsing-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you give a file tree, libGDX project settings sometimes get mixed up in different IDE's
– Basim Khajwal
Jun 26 '15 at 20:17
Are you sure you are exporting the map correctly? I know from the past that there are several different types of files you can produce with Tiled, when something is slightly off the parser cannot solve it by itself. However I did not use the build in importer much, I like to role my own.
– Madmenyo
Jun 26 '15 at 22:41
I used all the major tile layer formats (XML, CSV, Base64) (Currently XML). The file type is definitely tsx which is needed to run with LibGdx.
– Shuku
Jun 26 '15 at 23:00
Xml layer format is not supported. The stack trace clearly states that the file is not found. Typically, the
assets/portion is not part of the path as the internal files are relative to the assets directory.– nEx.Software
Jun 27 '15 at 0:23
What would be the supported format? I tried all of them.
– Shuku
Jun 27 '15 at 0:26