[SOLVED] AssetLoadException When use FileLocator.class or ZipLocator.class

I can render .j3o model and .obj model in my Android app, when those models are located in the app’s asset folder.
Now I moved my .j3o files to internal storage of the phone’s root folder and tried to load the model.
the model is located in the folder path of Models/CartoonHouse/CartoonHouse.j3o.

I registered the asset manager location like this.
assetManager.registerLocator("/storage/emulated/0/", FileLocator.class);
and loaded the model as
Spatial house = getAssetManager().loadModel(“Models/CartoonHouse/CartoonHouse.j3o”);

but I encountered the AssetLoadException , Failed to open the file .

com.jme3.asset.AssetLoadException: Failed to open file: /storage/emulated/0/Models/CartoonHouse/CartoonHouse.j3o at com.jme3.asset.plugins.FileLocator$AssetInfoFile.openStream(FileLocator.java:77) at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:108) at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259) at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373) at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416) at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420) at com.ar4android.superimposeJME.SuperimposeJME.initForegroundScene(SuperimposeJME.java:128) at com.ar4android.superimposeJME.SuperimposeJME.simpleInitApp(SuperimposeJME.java:84) at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220) at com.jme3.app.AndroidHarness.initialize(AndroidHarness.java:478) at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:328) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1548) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1259) Caused by: java.io.FileNotFoundException: /storage/emulated/0/assets/Models/CartoonHouse/CartoonHouse.j3o (Permission denied) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:146) at com.jme3.asset.plugins

Still I couldn’t able to find ideas to overcome this issue.

Thanks .

Seems like it could not find the model.

Why don’t you want to use the common assets folder?

I wanted to load from phone’s internal storage.

But the problem is solved now.
My mistake, forgot to give Permission.

Thanks

You can also See it here :slight_smile: always check the whole stacktrace

1 Like

Thank You

Yeah I should check.

Glad you solved your problem and posted the solution here!