Can't load PImage

I’m working on a project where I have to load a ton of images into an array list, The code works on Java fine and good but when I switch over to Android and export it to my phone it crashes.

My folder set up is like this:

/sketch/data/skins/

And this is the error I get when the sketch loads

FATAL EXCEPTION: Animation Thread
Process: processing.test.notsimplechess, PID: 24727
java.lang.IllegalArgumentException: File data/skins/default/00.png contains a path separator
	at android.app.ContextImpl.makeFilename(ContextImpl.java:2540)
	at android.app.ContextImpl.getFileStreamPath(ContextImpl.java:752)
	at android.content.ContextWrapper.getFileStreamPath(ContextWrapper.java:228)
	at processing.core.PSurfaceNone.getFileStreamPath(PSurfaceNone.java:317)
	at processing.core.PApplet.sketchPath(PApplet.java:5452)
	at processing.core.PApplet.createInputRaw(PApplet.java:4977)
	at processing.core.PApplet.createInput(PApplet.java:4809)
	at processing.core.PApplet.loadImage(PApplet.java:3949)
	at processing.test.notsimplechess.notSimpleChess$ImageDB.<init>(notSimpleChess.java:1001)
	at processing.test.notsimplechess.notSimpleChess.setup(notSimpleChess.java:84)
	at processing.core.PApplet.handleDraw(PApplet.java:1835)
	at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:476)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:516)

I’m not sure what I should change
Please help
Thanks

Do you really use a ‘/’ character in your file name?

      PImage temp = loadImage("data/skins/default/0"+i+".png");

I use folders…?

The best way is to save them in a folder just above the absolute path.
See here.

I looked at the other page and put in the permissions (read & write external storage) and that didn’t work same error, I’m not saving the files I’m loading them.

My file system is like this,

/SketchName
   SketchName.pde
   /data
      /skins
         /default
            00.png

This is the array loading loop (that works on java)

for (int i = 0; i < 6; i++) {
      temp = loadImage("data/skins/default/0"+i+".png");
      temp.resize((int)spacing, (int)spacing);
      lightDefault.add(temp);
      temp = loadImage("data/skins/default/1"+i+".png");
      temp.resize((int)spacing, (int)spacing);
      darkDefault.add(temp);
}

I don’t see what the difference would be by putting everything down a subfolder

I see.
If it is only for loading I guess you need to let out the data folder, because it starts searching from there.
Like:

temp = loadImage("skins/default/1"+i+".png");

Edit: I mean let out the string “data” from the function. Not the folder itself.

Thank you so much! that worked!

I’m sorry for upping this old theme,but i have same problem on APDE.
I can’t read the file from subfolder.

|-data
  |-assets
    |-some.jpg

I have tried this:

PImage img=loadImage(sketchPath("assets")+"/some.jpg"); //this one works,but only in Preview mode
//And this
PImage img=loadImage("data/assets/some.jpg");
// And this
PImage img=loadImage("assets/some.jpg");

After making .apk no one works(i tried other devices too)

P.S. my device is Xiaomi Redmi Note 5(android verion 8)