• Hello,

    I am now a proud owner and hopeful tinkerer of a Bangle JS 2. Firmware 2v14

    Besides the firmware update I have been unable to do anything to the Bangle from my Web IDE (Windows 10, Chrome).
    I can connect to the device and view and download files on the device.
    But I cannot update any apps, or remove apps using the AppLoader. I get a message saying "Invalid Json".

    The Alarm app hangs whenever I attempt to go to it on the device.

    Any help is appreciated!


  • Did you connect the watch to your phone before? If so, temporarily disable Bluetooth on the phone to let your PC connect.

  • Can you connect the IDE and check if something is printing stuff on the console? For me problems like this are usually caused by some app/widget/clock confusing the communication of the app loader. You can try switching to another app before trying to install something or even start the bangle without code. https://www.espruino.com/Bangle.js2#rese­tting-without-loading-any-code

  • I had the exactly same issue as sachinm had after updating to the latest cutting edge firmware version.

    Using the reset procedure as halemmerich suggested without loading code I could connect again and reset to the stable 2v14 firmware.
    With that version everything works again.

    Thanks for the hint!

  • Hi,
    This was a newbie mistake on part of this newbie :)
    I had the "programmable" set to OFF. Duh!

    Setting it to ON allowed me download the apps to the device.

    I still don't know where that Invalid JSON error was coming from.. but now that I can upload code I will try to figure that out.

    Thank, all!

  • Jepp. I also get the invalid JSON. Even after complete reinstall.

  • I also get this invalid JSON. I wonder if it is because I have an app I wrote uploaded via the ide instead of through the app loader.

  • It sometimes happen to me, but that's with the BangleJS Gadgetbridge app (in beta testing).

    If I close the Android app and reopen it then it works fine for a while.

  • It's definitely worse on the bangle gadget bridge app but I get it a lot using the app loader through chrome too

  • Yes, this might be the cause. But it never happend with older versions.

  • If I fork the app loader and add my app to it, can I set it so changes on the official app loader are made in my custom one? I'm new to github and don't yet know how it works. Sorry for going a bit off topic.

  • At the top of your repo there will be a "fetch upstream" button, use that and it'll update the master branch with the current official state. If you've worked in another branch you then need to merge master into that branch.

  • Thank you. I'll have a play

  • Can anyone who gets this try and check in the Chrome debug log and see if there are any messages in the console that might shed light on what the 'Invalid JSON' actually was?

  • Unfortuneatly I get it only in Gadgetbridge (in my case - but it turns the app installer useless) but not on Chromium on Linux - so I cannot take a look at the console.

  • I also have the error mainly in GadgetBridge and Chrome in Android.
    I tried this with Chrome and tried to debug via the computer (https://www.addictivetips.com/android/ge­t-web-console-log-chrome-for-android/). But have not found a clear indication for the error.

    I also tried this in GadgetBridge via Android Studio using LogCat. I couldn't see any obvious errors there either. The json string seems to arrive. I see at least log output of type UART RX with a json containing all my apps.

    When I have more time, I'll take another closer look. Probably not until the weekend :(

  • so I cannot take a look at the console.

    Well, luckily - if you're using the 'Bangle.js Gadgetbridge' you can go to 'Debug -> Get Device Logs' and then post those up. They should show all the communications between the Bangle and Gadgetbridge, which is probably better :)

    I also tried this in GadgetBridge via Android Studio using LogCat

    Brilliant - thanks! The issue could be other data that gets sent around that time, or it is possible that in Gadgetbridge it's to do with the way I use LocalBroadcast to send the UART data. I think somehow sometimes the packets can get mixed up/duplicated/lost on their way to the app loader.

  • Just ran into this while uploading the messages app, looking at the JS console it seems to be caused by the status update.
    IIRC those are sent with a small delay after you connect. That would match what I did:

    1 disconnect watch from phone
    2 press upload in app loader on PC
    3 select the watch and connect -> error

    <COMMS> ERROR Parsing JSON SyntaxError: Unexpected token { in JSON at position 298
    comms.js:261 <COMMS> Actual response:  "{\"id\":\"messages\",\"name\":\"Message­s\",\"src\":\"messages.app.js\",\"icon\"­:\"messages.img\",\"sortorder\":-9,\"ver­sion\":\"0.47\",\"tags\":\"tool,system\"­,\"files\":\"messages.info,messages.app.­js,messages.settings.js,messages.img,mes­sages.wid.js,messages\",\"data\":\"messa­ges.json,messages.settings.json;messages­.jsonl\"}\r\n\r\n{\"t\":\"status\",\"bat­\":100,\"chg\":0}\r\n"
    ui.js:86 <TOAST>[error] Messages update failed, Error: Invalid JSON
  • Interesting - thanks! I reckon we could probably split based on newlines (as they shouldn't be in JSON) and then it'd be a lot easier to throw away things that weren't what we were expecting

  • It happens to me both on on the web browser (Bromite, Chromium-based) and the BangleJS Gadgetbridge app (Chrome WebView).

    I just force-close the browser or the BangleJS Gadgetbridge app, and on the next connection it doesn't generate the error.

  • Right now when this happens I think all you need to do is to go to the My Apps tab and click 'refresh' to get it working... But I'll see what I can do about this today

  • Ok, I've made some changes to the development app loader which should hopefully improve the situation quite a lot. Assuming nothing seems broken in a day or so I'll push it live to the main app loader

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Unable to upload or remove apps from Bangle JS 2. Invalid JSON

Posted by Avatar for sachinm @sachinm