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
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.
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)