-
-
@rullen, this is certainly the error that is described here:
http://forum.espruino.com/conversations/379050/ -
-
-
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/get-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 :(
-
With the URL "https://banglejs.com/reference" I get the following exception:
org.xml.sax.SAXParseException: unterminated entity ref
(position:ENTITY_REF @1:1230 in java.io.StringReader@299f0e3) at
org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:147)
at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:474) at
org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:521) at
gutzeit.com.xpathtest.MainActivity.lambda$testAsync$0(MainActivity.java:123)
at
gutzeit.com.xpathtest.MainActivity$$ExternalSyntheticLambda0.run(Unknown
Source:0) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
--------------- linked to ------------------ javax.xml.xpath.XPathExpressionException:
org.xml.sax.SAXParseException: unterminated entity ref
(position:ENTITY_REF @1:1230 in java.io.StringReader@299f0e3) at
org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:479) at
org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:521) at
gutzeit.com.xpathtest.MainActivity.lambda$testAsync$0(MainActivity.java:123)
at
gutzeit.com.xpathtest.MainActivity$$ExternalSyntheticLambda0.run(Unknown
Source:0) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923) Caused by:
org.xml.sax.SAXParseException: unterminated entity ref
(position:ENTITY_REF @1:1230 in java.io.StringReader@299f0e3) at
org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:147)
at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:474) ...
6 moreI was interested to see if this works for anyone. It would be great if someone could try this out.
-
@myxor, thank you for your response.
I'll have another look this evening.
But there were different exceptions depending on the page I wanted to load.
If you open the html, for example with firstobject XML editor, you will also see structural errors due to the embedded javascript. As already written above, very simple HTML/XML structures work.Does the example work for you/anyone?
Bluetooth.println(JSON.stringify({t:"http",url:"https://banglejs.com/reference",xpath:"/html/body/div/h2"}));
If so, then it seems to be probably a problem with my phone. I do not want to exclude that. It is the Teracube 2e with Android 11 (there are some open issues with the phone).
I have now modified Bangle.js Gadgedbridge for my use and added Jsoup. I also added the possibility to execute multiple XPath expressions (or selectors) with one call. If I ever have some time, I'll refactor the code and create a merge request.
-
Hi,
I have a similar problem as described in post "Unable to upload or remove apps from Bangle JS 2. Invalid JSON".With my phone I barely can connect to the AppLoader at all. Every time I get the error "invalid json".
The error occurs with the Bangle.js GadgetBridge app and the AppLoader in Chrome.
I have tried everything, disconnect and reconnect Bluetooth, reload app, reboot watch, reboot phone, factory reset, ...Finally I found a working but very unsatisfying solution. I have to pair the watch with the phone, disconnect of course. Then I can connect to the AppLoader without any problems. After that, I have to remove the pairing, otherwise the phone will always connect to the watch automatically.
How to further analyze the error? Is there any way to debug or view logs?
-
Hi,
I have tried the function "access the internet", but have encountered problems.
I have tried several web pages, with each one I get a (different) SaxParseException.For example, the following call results in the exception:
Bluetooth.println(JSON.stringify({t:"http",url:"https://banglejs.com/reference",xpath:"/html/body/div/h2"}));
Does the call work for anyone? Is it possibly a problem with my phone?
Using the relevant lines from the BanglejsGadgetBridge project, I was able to recreate the error in a small sample project of my own.
InputSource inputXML = new InputSource(new StringReader(response)); XPath xPath = XPathFactory.newInstance().newXPath(); response = xPath.evaluate(xmlPath, inputXML);
Simple HTML/XML structures work, but complex web pages do not. I think the parser can't handle the embedded JavaScript. But I am not sure.
I searched for other solutions and tried Jsoup. For me it worked very well.
Document doc = Jsoup.parse(response); response = doc.select(xmlPath).html();
A big disadvantage is that XPath cannot be used, but selector.
The question is, am I alone with this problem? Can someone help me to get the default implementation to work? Is an implementation with Jsoup possible, or is there something against it?
-
@PeerDavid, thank you very much, this works great.
I just looked a bit more, this is probably because it is defined this way in the product flavor(https://github.com/gfwilliams/Gadgetbridge/blob/master/app/build.gradle) -
I tried Bangle.js GadgetBridge and encountered a problem. I use the Android app "Kleine Wettervorschau Deutschland" (F-Droid) to get weather data on the watch. It works with the original GadgetBridge app, but not with the Bangle.js GadgetBridge version.
In the app you can set a package name (default is "nodomain.freeyourgadget.gadgetbridge") in case you use a forked GadgetBridge app. Unfortunately, I couldn't figure out what to enter in there to make it work with the Bangle.js GadgetBridge app.
Does anyone have any ideas? -
I have now figured it out.
The method called was from Gadgetbridge Music Controls. After uninstalling Gadgetbridge Music Controls it works now.
This means that you can only bind the events once?
Or is there a way that both can work?Thank you very much for the help. It is really fun to play around with the watch.
-
Thank you for your feedback.
The widget is displayed, only the GB events seem not to arrive.
As an app the code works as well (without the widget-specific code, of course).
Generally, the code (especially GB) should work as a widget?When running in RAM print(GB) (in the left side of the IDE) displayed the correct method (from the code above).
When running in storage another method is displayed.
I have no idea why this is happening. -
Hi,
I am trying to write a widget that shows the currently played track.
I have the following code://WIDGETS = {}; (() => { var musicInfo; var _GB = global.GB; global.GB = (event) => { switch (event.t) { case "musicinfo": musicInfo = event; WIDGETS["mymusic"].draw(); break; } if(_GB)setTimeout(_GB,0,event); }; function draw() { g.reset(); g.clearRect(this.x,this.y,this.x+176,this.y+16); g.setFont("Vector",16); if (musicInfo !== undefined) { g.drawString(musicInfo.track,this.x,this.y); } } WIDGETS["mymusic"]={area:"bl",width:176,draw:draw}; })(); //Bangle.drawWidgets();
When loading into RAM it works. When using the left side of Espruino Web IDE and sending GB messages, the tracks are displayed.
However, when loading the code in storage, it does not work. No tracks are displayed.
What is the difference between RAM and storage?
perfect, works again.
thanks