Libgdx android xml saving

Okay i have the saving done for my tile map game done and it works perfect on the computer however on android it crashes everytime and i cant get hold of the stacktrace so please dont ask

here is my code

package com.hawk.engine.game.xml;

import java.io.IOException;
import java.io.Writer;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
import com.badlogic.gdx.utils.XmlWriter;
import com.hawk.engine.game.input.Button;
import com.hawk.engine.game.level.BlockNames;
import com.hawk.engine.game.level.Level;
import com.hawk.engine.game.level.Tile;
import com.hawk.engine.game.level.ToolNames;
import com.hawk.engine.game.level.tiles.Water;
import com.hawk.engine.game.window.Window;

public class XMLMap {

	
	// Button propertys
	private static Button safeIconButton;
	private static float timer,timercap;
	private static FileHandle file;
	private static Array<Element> list;
	
	public static void create(){
		safeIconButton = new Button(Window.mainSheet.getImage(ToolNames.getSAVEICON()), 30, Window.camera.viewportHeight-180, 60, 60, new Vector2(0,0));
		timercap = 0.07f;
		timer = 0;
	}
	
	public static void saveMap(String name){
		
		file = Gdx.files.local(name+".xml");
		Gdx.app.postRunnable(new Runnable(){
			public void run(){
				Writer writer = file.writer(false);
				XmlWriter xml = new XmlWriter(writer);
				
				try {
					xml.element("map");
					//int whatisit, int blockID, float x, float y, float width, float height, Vector2 velocity, boolean hasCollision, boolean object, int objectID
					for(int i = 0;i < Level.lengthX;i++){
						for(int j = 0;j < Level.lengthX;j++){
							
							Tile t = Level.tiles[i][j];
							xml.element("t").attribute("w", t.getBlockDef()).attribute("bID", t.getBlockVecID())
							.attribute("x", t.getX()).attribute("y", t.getY()).attribute("wi", t.getWidth()).attribute("he", t.getHeight()).attribute("vx", 0).attribute("vy", 0)
							.attribute("co", t.isCollision()).attribute("o", t.isObject()).attribute("oID", t.getObjectID()).pop().flush();
						}
					}
					xml.pop();
					writer.close();
					
					
				} catch (IOException e) {
					e.printStackTrace();
				}
				
			}
		});
		
		
	}
	public static void render(float delta){
		safeIconButton.render(delta);
	}
	public static void tick(float delta){
		safeIconButton.tick(delta);
		if(timer > timercap){
			timer = 0;
		if(safeIconButton.isClicked){
			saveMap("map1");
		}
		}
		timer += delta;
	}
	public static void loadMap(String name){
		
//		Element e = XML.out.get(i * XML.lengthX + j);
//		Map.tiles[i][j].setX(Integer.parseInt(e.getAttributeValue("x")));
//		Map.tiles[i][j].setY(Integer.parseInt(e.getAttributeValue("y")));
//		
//		Map.tiles[i][j].setCropX(Integer.parseInt(e.getAttributeValue("imagecropX")));
//		Map.tiles[i][j].setCropY(Integer.parseInt(e.getAttributeValue("imagecropY")));
		XmlReader xml = new XmlReader();
		try {
			list = xml.parse(Gdx.files.local(name+".xml")).getChildrenByName("t");
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		Gdx.app.postRunnable(new Runnable(){
			public void run(){
					for(int i = 0;i < Level.lengthX;i++){
						for(int j = 0;j < Level.lengthX;j++){
							
							// Loads all tiles
							Element e = list.get(i * Level.lengthX + j);
							Level.tiles[i][j] = new Tile(Integer.parseInt((e.getAttribute("w"))), Integer.parseInt((e.getAttribute("bID"))), Float.parseFloat((e.getAttribute("x"))), Float.parseFloat((e.getAttribute("y"))), Float.parseFloat((e.getAttribute("wi"))), Float.parseFloat((e.getAttribute("he"))), new Vector2(0,0), Boolean.parseBoolean((e.getAttribute("co"))), Boolean.parseBoolean((e.getAttribute("o"))), Integer.parseInt((e.getAttribute("oID"))));
							
							
							// Adds water
							// WATER AT EDGE
							if(i >= 1 && j == 1 || i == 1 && j >= 1 || i >= 1 && j == Level.lengthX-2 || i == Level.lengthX-2 && j >= 1 || i >= 2 && j == 2 || i == 2 && j >= 2 || i >= 2 && j == Level.lengthX-3 || i == Level.lengthX-3 && j >= 2){
								Level.tiles[i][j] = new Water(Tile.TILE,BlockNames.WATERID, i*Level.tileSizeWidth, j*Level.tileSizeHeight, Level.tileSizeWidth,Level.tileSizeHeight, new Vector2(0,0),false);
							}
							if(i >= 0 && j == 0 || i == 0 && j >= 0  || i >= 0 && j == Level.lengthX-1 || i == Level.lengthX-1 && j >= 0){
								Level.tiles[i][j] = new Water(Tile.TILE,BlockNames.WATERID, i*Level.tileSizeWidth, j*Level.tileSizeHeight, Level.tileSizeWidth,Level.tileSizeHeight, new Vector2(0,0),true);
							}
							//-----------------------------------------
							
						}
						
					}
				
			}
		});
			
	}
}

Well, no stacktrace, no help :-\ It’s just impossible to debug an error, if you don’t have any information.

Also don’t use static variables. The stuff they hold will never be collected by the garbage collector. Especially never hold anything outside of a method that you don’t need outside of the method!

There’s no way to fix a problem if you don’t know what the problem is.

You can connect LogCat to your Android device.
Google that up how to do it in case your phone is not recognized.
Then you also have the stack trace.

Having a working logging is a minimum requirement for development.

just need to repost this … way too good :

http://s.mlkshk.com/r/D00U

Every time you post something I want to rip my eyes out, if you want help on how to develop games and solve problems then at a MINIMUM learn how to use the basics of your IDE (You seem ok with the language from what I have seen). I was the same when I started to learn, ignored the features of the IDE and used it as a glorified text editor.

At the risk of sounding like an utter dick, perhaps it might be best to start at the basics. As most of your posts go along the lines of:

Should I do XYZ
Can someone show me how to do XYZ
Help I am stuck on a problem with this XYZ thing

Take a step back, make pong, make space invaders and enjoy the process.

I think I’ve wrote this statement for like half a dozen people lol.

Gibbo on fire.

Well he’s not wrong.
The issue runs rampant of this forum… :emo:

That IS my working day… If we didn’t have a “clean desk” policy, that would be pinned up over my desk.

I HAVE that image hanging behind my desk ;D
already for like a year.