Error in AppInventor: Expected a ',' or '}'

I'm trying to make my own AppInventor for my personal use and for testing.

I followed all of the instructions in the GitHub README.md file, I passed the buildtools test and I cleaned the directory using ant clean, but when I tried to run ant, I run into an error.

I did not make any changes to AppInventor, I just cloned it and ran it. I did not touch any files.

BlocklyCompile:

BlocklyTranslationGenerator:
    [mkdir] Created dir: C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\blocklyeditor\build\classes\BlocklyTranslator-classes
    [mkdir] Created dir: C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\build\blocklyeditor\msg
    [javac] Compiling 1 source file to C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\blocklyeditor\build\classes\BlocklyTranslator-classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

BUILD FAILED
C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\build.xml:16: The following error occurred while executing this line:
C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\build-common.xml:301: The following error occurred while executing this line:
C:\Users\dell\Documents\AppInventor\appinventor-sources\appinventor\blocklyeditor\build.xml:95: org.json.JSONException: Expected a ',' or '}' at 56001 [character 296 line 791]
        at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
        at org.json.JSONObject.<init>(JSONObject.java:229)
        at org.json.JSONObject.<init>(JSONObject.java:321)
        at msg.BlocklyTranslationGenerator.main(BlocklyTranslationGenerator.java:74)
        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 org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:221)
        at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:154)
        at org.apache.tools.ant.taskdefs.Java.run(Java.java:832)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:226)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:352)
        at org.apache.tools.ant.Target.execute(Target.java:437)
        at org.apache.tools.ant.Target.performTasks(Target.java:458)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:352)
        at org.apache.tools.ant.Target.execute(Target.java:437)
        at org.apache.tools.ant.Target.performTasks(Target.java:458)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:352)
        at org.apache.tools.ant.Target.execute(Target.java:437)
        at org.apache.tools.ant.Target.performTasks(Target.java:458)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1377)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
        at org.apache.tools.ant.Main.runBuild(Main.java:857)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Total time: 20 seconds

I've had this error for a few days before now. Help is appreciated.

Did you clone it recently?

Yes.

You should check the any changes you've made to blocklyeditor/src/msg/ai_blockly/messages.json. The error in question is failing in the code that computes the final set of messages for each language by populating missing keys in other languages from their English counterparts.

1 Like

I did not change the code, I checked it and matched it. I tried to copy the code from GitHub back into AppInvenor, the error still appears.

You should be able to use git status to check what files in that directory have changed and git diff to see the changes if any.

2 Likes
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Before I check this, I cloned the repo again, and the error still occurs...

What is the default file encoding on your machine? You may want to try adding:

<jvmarg value="-Dfile.encoding=UTF8"/>

to the <java> tag in the BlocklyTranslationGenerator target in blocklyeditor/build.xml if your default encoding isn't UTF-8 since it might be that Java's File API is incorrectly decoding the JSON content on your machine.

1 Like