Problem loading assets


I have just started to try out Android development in JMonkey.

I’ve tried a couple of the tutorials with Android, and they seem to work fine. I am now trying to load a very simple mesh and always receive an asset not found exception.

My code simply loads the mesh, and attaches it to the root node. There is also a light source and thats it.

The source mesh is in the assets folder and it runs fine on the PC.

Does anybody have any ideas what’s wrong?


On android you can only use j3o models.

To convert your model from xml to j3o use this class that I made:

[java]package start;




import com.jme3.asset.plugins.FileLocator;

import com.jme3.export.binary.BinaryExporter;

import com.jme3.scene.Spatial;

public class MainClass extends SimpleApplication{

public static void main(String[] args){

new MainClass().start();


public MainClass(){

this.showSettings = false;


private static String source = "C:/Users/Ägaren/Desktop/";

private static String name = "skybox";


public void simpleInitApp() {

assetManager.registerLocator(MainClass.source, FileLocator.class.getName());

Spatial model = assetManager.loadModel(name+".mesh.xml");

BinaryExporter ex = BinaryExporter.getInstance();

File f = new File(source+name+".j3o");

try {, f);


System.out.println("File "+name+" was successfully converted to j3o.");
System.out.println("Path to j3o: "+source+name+".j3o");
} catch (IOException e) {
chage source to the folder of your xml model. And the name to the name of your xml model (without the .mesh.xml part)
When this has run the j3o file will be next to the xml one.
  1. jme does not support lighting yet. If you succed to pass by the errors the results will not be pleasent. I’v done it.
  2. I think you load your mesh the wrong way. The assetmanaged cant find it. Post the code of the process of loading the model.


Thanks for the response.

I though light was required to make the objects visible?

Here is the code for loading the model:

Spatial cube = assetManager.loadModel(“Models/Test/Cube.mesh.xml”);




Will this do something different to when you right click the mesh in the ide and select “Convert to j3o binary”? The reason I ask is because I’ve tried with .mesh.xml and .j3o files and the result is the same.


No, I thought u didn’t use the sdk.

Ohwell. i think the problem is you do not add material.

cube.setMaterial(new Material(new Material(getAssetManager(),“Common/MatDefs/Misc/Unshaded.j3md”)));

@Addez, your importer will create models that can only be loaded from the root path. A j3o has to ind the images in the location they were loaded in the original asset manager.

The material is part of the model being imported. It has a material file. Like I said, it works fine on the PC (a blue cube shows up). When run on Android, it’s like it can’t find the model file to import.

I searched other posts in the forums to see if assets had to be added manually for android. However, from what I could find, everything indicated that this should be automatic.

@Addez said:
1) jme does not support lighting yet. If you succed to pass by the errors the results will not be pleasent. I'v done it.

That's wrong, lighting works fine, it's just slow on android. It can have decent performance if you use vertex lighting instead of fragment lighting
The fact that you did not manage to make it work cannot be considered as a valid point.

@gsxruk the problem here, as Addez stated, is that you directly use a mesh.xml file. It's not exported in the apk.
Convert it to j3o and then load the j3o in your code and not the mesh.xml, and it should work fine.

This is quoted you in a previous post to me:

“well actually , i’m kinda surprise it doesn’t crash…

Shadows are not supported yet on android”

found here:


lighting != shadows


Okej, well I guess I’ll add lighting to my game aswell then.