Exception: java.lang.ArrayIndexOutOfBoundsException - 0 ui.util.Resources.readMultiImage

17 views
Skip to first unread message

Gareth Murfin

unread,
Apr 24, 2020, 1:42:19 AM4/24/20
to CodenameOne Discussions
For some reason when I add a multiimage using the gui editor, then run my app it crashes with the error below. It seems like there is something wrong with the image somehow, I tried resaving in photoshop but it always happens, the only way to fix it is to replace the .res with a backup one. Any ideas whats going on ?


java.lang.ArrayIndexOutOfBoundsException: 0
[EDT] 0:0:1,420 - Exception: java.lang.ArrayIndexOutOfBoundsException - 0
at com.codename1.ui.util.Resources.readMultiImage(Resources.java:1099)
at com.codename1.ui.util.Resources.readMultiImage(Resources.java:1072)
at com.codename1.ui.util.Resources.createImage(Resources.java:1054)
at com.codename1.ui.util.Resources.createImage(Resources.java:964)
at com.codename1.ui.util.Resources.openFileImpl(Resources.java:309)
at com.codename1.ui.util.Resources.openFile(Resources.java:272)
at com.codename1.ui.util.Resources.<init>(Resources.java:192)
at com.codename1.ui.util.Resources.open(Resources.java:743)
at com.codename1.ui.util.Resources.openLayered(Resources.java:705)
at com.codename1.ui.util.Resources.openLayered(Resources.java:669)
at generated.StateMachineBase.startApp(StateMachineBase.java:57)
at generated.StateMachineBase.<init>(StateMachineBase.java:31)
at generated.StateMachineBase.<init>(StateMachineBase.java:120)
at userclasses.StateMachine.<init>(StateMachine.java:73)
at com.pippa.hobmonitor.MyApplication.start(MyApplication.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.codename1.impl.javase.Executor$3$1.run(Executor.java:261)
at com.codename1.ui.Display.processSerialCalls(Display.java:1303)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1097)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.io.IOException: 0
at com.codename1.ui.util.Resources.open(Resources.java:758)
at com.codename1.ui.util.Resources.openLayered(Resources.java:705)
at com.codename1.ui.util.Resources.openLayered(Resources.java:669)
at generated.StateMachineBase.startApp(StateMachineBase.java:57)
at generated.StateMachineBase.<init>(StateMachineBase.java:31)
at generated.StateMachineBase.<init>(StateMachineBase.java:120)
at userclasses.StateMachine.<init>(StateMachine.java:73)
at com.pippa.hobmonitor.MyApplication.start(MyApplication.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.codename1.impl.javase.Executor$3$1.run(Executor.java:261)
at com.codename1.ui.Display.processSerialCalls(Display.java:1303)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1097)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
at generated.StateMachineBase.initTheme(StateMachineBase.java:110)
at generated.StateMachineBase.startApp(StateMachineBase.java:61)
at generated.StateMachineBase.<init>(StateMachineBase.java:31)
at generated.StateMachineBase.<init>(StateMachineBase.java:120)
at userclasses.StateMachine.<init>(StateMachine.java:73)
at com.pippa.hobmonitor.MyApplication.start(MyApplication.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.codename1.impl.javase.Executor$3$1.run(Executor.java:261)
at com.codename1.ui.Display.processSerialCalls(Display.java:1303)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1097)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Java Result: 1

Shai Almog

unread,
Apr 24, 2020, 2:36:53 AM4/24/20
to CodenameOne Discussions
How did you edit the multi image?
Does the theme open in the designer tool?
Is XML team mode on?
Does it open with it off?

Gareth Murfin

unread,
Apr 24, 2020, 3:10:25 AM4/24/20
to CodenameOne Discussions
Hi Shai, 

Thanks for the help..
Theyre pngs from client, i did quick add multi images, seems ok, then i save and run my app and it gives that error.  
The theme does open yes, but when i go to delete unused images it hangs.
Ive never touched xml team mode so I dont think its on.
It works ok if I dont use multi images and just add image normally using "add images"..

Image dimensions are 1080x865, I tried resizing to 1080x864 (in photoshop) to be multiple of 8 but it didnt help. In add multi images I tried various different source resolutions but it still happened. 

Shai Almog

unread,
Apr 25, 2020, 12:06:52 AM4/25/20
to CodenameOne Discussions
Can you check if it's on?
If so you can look at the directory containing the images under the res hierarchy and see what's added there.
Reply all
Reply to author
Forward
0 new messages