Prashant Rahate
Prashant Rahate

Reputation: 163

Corrupt theme file unrecognized magic number: 0 [CodenameOne]

Why am getting below error in codename one while running or opening theme file. please provide solution on same.

java.io.IOException: Corrupt theme file unrecognized magic number: 0
com.svastikagames.gkquiz.MyApplication.start() Error java.lang.NullPointerException
at com.codename1.ui.util.Resources.openFileImpl(Resources.java:332)
at com.codename1.ui.util.Resources.openFile(Resources.java:261)
at com.codename1.ui.util.Resources.<init>(Resources.java:181)
at com.codename1.ui.util.Resources.open(Resources.java:729)
at com.codename1.ui.util.Resources.openLayered(Resources.java:694)
at com.codename1.ui.util.Resources.openLayered(Resources.java:658)
at generated.StateMachineBase.startApp(StateMachineBase.java:59)
at generated.StateMachineBase.<init>(StateMachineBase.java:31)
at generated.StateMachineBase.<init>(StateMachineBase.java:124)
at userclasses.StateMachine.<init>(StateMachine.java:236)
at com.svastikagames.gkquiz.MyApplication.start(MyApplication.java:25)
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$1$1.run(Executor.java:100)
at com.codename1.ui.Display.processSerialCalls(Display.java:1149)
at com.codename1.ui.Display.mainEDTLoop(Display.java:966)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

Upvotes: 1

Views: 181

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

Usually this error means the file is 0 length and got corrupted at some point due to an unclear reason.

If the file is of 0 length there is nothing we can do to help recover its content unless you are using the XML team mode.

If you are using that then just launch the designer tool from command line and edit the theme it should actually work since it loads the resources from the XML's under the res directory and not the res file itself. If it prints out errors during save these might help you narrow down the problem and you can also refer these errors to us.

In order to launch the designer from command line use this on Unix/Linux/Mac:

java -jar ~/.codenameone/designer_1.jar

And on Windows:

java -jar MY_USER_DIRECTORY\.codenameone\designer_1.jar

Upvotes: 0

Related Questions