Compiler Error: SP at end of 'then' was 5 while SP at end of 'else' was 0

121 views
Skip to first unread message

Ben Browne

unread,
Mar 6, 2018, 12:24:09 PM3/6/18
to MIT App Inventor Forum
Can someone please explain this to me? I have no errors in my code, so I'm not sure why I keep getting this error.

App Inventor is unable to compile this project. 
The compiler error output was 
________Preparing application icon
________Creating animation xml
________Creating style xml
________Generating manifest file
________Attaching native libraries
________Attaching Android Archive (AAR) libraries
________Attaching component assets
________Invoking AAPT
AAPT time: 0.475 seconds
________Compiling source files
(compiling appinventor/ai_sackboy901/THoaW/Screen1.yail to appinventor.ai_sackboy901.THoaW.Screen1)
ERROR: appinventor/ai_sackboy901/THoaW/Screen1.yail line 15: caught exception in inline-compiler for #<procedure gnu.kawa.functions.AppendValues> - java.lang.Error: at PC 611: SP at end of 'then' was 5 while SP at end of 'else' was 0
gnu.bytecode.CodeAttr.emitFi(CodeAttr.java:1906)
gnu.expr.IfExp.compile(IfExp.java:135)
gnu.expr.IfExp.compile(IfExp.java:52)
gnu.expr.Expression.compileNotePosition(Expression.java:156)
gnu.expr.Expression.compileWithPosition(Expression.java:127)
gnu.kawa.functions.AppendValues.compile(AppendValues.java:43)
gnu.expr.ApplyExp.inlineCompile(ApplyExp.java:587)
gnu.expr.ApplyExp.compile(ApplyExp.java:174)
gnu.expr.ApplyExp.compile(ApplyExp.java:111)
gnu.expr.Expression.compileNotePosition(Expression.java:156)
gnu.expr.Expression.compileWithPosition(Expression.java:142)
gnu.expr.LambdaExp.compileBody(LambdaExp.java:1619)
gnu.expr.Compilation.generateBytecode(Compilation.java:2107)
gnu.expr.Compilation.process(Compilation.java:1984)
gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:330)
gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:315)
kawa.repl.compileFiles(repl.java:783)
kawa.repl.processArgs(repl.java:412)
kawa.repl.main(repl.java:827)
Kawa compile time: 32.381 seconds

Chris Ward

unread,
Mar 6, 2018, 1:29:41 PM3/6/18
to mitappinv...@googlegroups.com
Hi Ben

Does seem to be very specific - post a screenshot of Screen1's Blocks please (right-mouse click on Blocks Viewer, "Download Blocks as Image").

Ben Browne

unread,
Mar 6, 2018, 3:42:29 PM3/6/18
to MIT App Inventor Forum
Here's the screenshot! Thanks in advance
blocks (3).png

Abraham Getzler

unread,
Mar 6, 2018, 3:43:37 PM3/6/18
to MIT App Inventor Forum
Post the .aia export too.

Did you operate on the project file?

Did you work on it under any non-MIT server?

ABG

Ben Browne

unread,
Mar 6, 2018, 4:10:37 PM3/6/18
to MIT App Inventor Forum
I never exported the file, and I only used the MIT server.

I do have a TinyWebDB component, but I haven't done anything with it. Could that be the problem?

Abraham Getzler

unread,
Mar 6, 2018, 4:34:39 PM3/6/18
to MIT App Inventor Forum
How much text do you have in those global initialization blocks?

You might have to load your text from Media text files at startup time,
For simplicity, use one File control per file,
so you can have different .GotText event blocks for each file.

For a table-driven adventure, see

ABG

Chris Ward

unread,
Mar 6, 2018, 4:37:27 PM3/6/18
to MIT App Inventor Forum
Ah Ben, ABG is asking you to post the Project File so that we can examine it.


Ben Browne

unread,
Mar 6, 2018, 4:43:45 PM3/6/18
to MIT App Inventor Forum
I'm programming a large scale text adventure, so I have quite a bit of text. I cleared those variables and it compiled just fine. I'll have to use a different method to retrieve the text.

Thanks so much for the help!

Abraham Getzler

unread,
Mar 6, 2018, 4:48:02 PM3/6/18
to MIT App Inventor Forum
You might find a usable table format for adventures here ...

ABG

Chris Ward

unread,
Mar 6, 2018, 4:48:47 PM3/6/18
to MIT App Inventor Forum
What I can't see is an IF THEN ELSE that should worry the compiler, though a some of your code could be described as unconventional :)

ABG makes a very good point about initialisation of text Globals - one of the things we just can't judge with only an image of the Blocks.

Make sure you copy the file Projects, My Projects, Save project as ...  and also use Export selected project (.aia) to my computer (do this very regularly as a safeguard).

It might be that either your Internet Connection or the MIT Server were not 100% perfect during the time you were trying to compile, so having saved the project to your PC, you could of course try to compile again. The most straight-forward is to Build, App (save .apk to my computer).

Chris Ward

unread,
Mar 6, 2018, 4:52:35 PM3/6/18
to MIT App Inventor Forum
... ah, your post went in while I was writing mine. ABG to the rescue!

I think that could be advice worthy of the FAQ?

Abraham Getzler

unread,
Mar 6, 2018, 4:52:59 PM3/6/18
to MIT App Inventor Forum
Also see https://docs.google.com/document/d/1AuhZjdMP55Cl9uOrrPG6x_FpZHlPInTaUfEhiwzDUh8/edit?usp=sharing
for an example of how to load game data from JSON coded text files.
ABG

Abraham Getzler

unread,
Mar 6, 2018, 5:03:56 PM3/6/18
to MIT App Inventor Forum
@Chris
I think that could be advice worthy of the FAQ?

Who, what?
I lost track.
ABG
 

Chris Ward

unread,
Mar 7, 2018, 2:04:24 PM3/7/18
to MIT App Inventor Forum
Hi ABG

... how to handle large amounts of text.

Abraham Getzler

unread,
Mar 7, 2018, 2:32:32 PM3/7/18
to MIT App Inventor Forum
(added to Advice and App Inventor Issues sections of FAQ)
ABG

Reply all
Reply to author
Forward
0 new messages