Closed arifinreinaldo closed 1 year ago
@arifinreinaldo everything is possible ;-)
I already made some changes for older android versions, but i have no test env here. What is the error you are facing on android 7?
Hi @rbri , thank you for your swift response.
I'm trying to run program in Android API Level 25, and I'm faced with run time error.
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/reflect/Executable; at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:208) at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:193) at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:67) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:686) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:702) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:161)
I'm assuming that Ljava/lang/reflect/Executable crashed because it's being added at Android API 26 (https://developer.android.com/reference/java/lang/reflect/Executable). That's why I'm planning to downgrade the HtmlUnit to a version that is running without the Executable. Currently I'm trying to implement what you do with a lower version of HtmlUnit with version 2.15 or 2.20. Is it a viable solution from your opinion? Thanks
will have a look
Thanks, if you need any additional information, please let me know.
@arifinreinaldo thanks, looks like i have to do a bigger change in HtmlUnit (at the moment i guess there is a huge bug that i have to sort out). Hope i can address this during this week. Will come back to you if i have something to test.
@arifinreinaldo made a first snapshot build available 2.66.0-SNAPSHOT - please try and report your findings
hi @rbri , thanks for the updated code.
I have tried and there is a new error
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at org.apache.commons.io.IOUtils.<clinit>(IOUtils.java:183) at org.apache.commons.io.IOUtils.read(IOUtils.java:1685) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.read(EncodingSniffer.java:1101) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.sniffHtmlEncoding(EncodingSniffer.java:550) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.sniffEncoding(EncodingSniffer.java:462) at com.gargoylesoftware.htmlunit.WebResponse.getContentCharsetOrNull(WebResponse.java:172) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:178) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
It seems it has a same problem with the problem in https://stackoverflow.com/questions/73604534/no-static-method-threadlocal-withinitial-commons-io-dependency.
Ok, please try the next snapshot - i guess you will see another error.
Hi @rbri , I have tried the snapshot again and it has different error.
No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
Here's the log. Thank you
Ok, next version is ready - please try
helo @rbri , using version -> net.sourceforge.htmlunit:htmlunit-android:2.66.0-SNAPSHOT
error still the same
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
@arifinreinaldo strange please try again
@rbri , still the same error. I have tried invalidate cache and rebuild project. Any other suggestions what to do?
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
so the change was this time in HtmlUnit - i will try to redeploy the snapshot build
Ok, do I need to increase the snapshot version build for htmlandroid?
no htmlunit is part of the htmlunit androind jar
please try again
implementation 'net.sourceforge.htmlunit:htmlunit-android:2.66.0-SNAPSHOT'
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
I think its still the same error
maybe I can embed the snapshot jar to check without the dependency from maven?
yes is till the same
maybe you can try to force a refresh ....https://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies
sorry looks like a fault at my side...
ok, my maven was the problem - no idea why my local repo was not updated
Please try again and sorry for the confusion.
already try gradle refresh dependency, but i think its still the same
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
you are right, for some reasons the android build picks up a wrong version will have a look again - sorry
please try again
Tried with invalidate cache, the error is this
Still the same error I think
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
Strange
i checked it again - the file https://oss.sonatype.org/content/repositories/snapshots/net/sourceforge/htmlunit/htmlunit-android/2.66.0-SNAPSHOT/htmlunit-android-2.66.0-20221019.105506-7.jar does not use the failing call (by decompiling it).
Can you please verify if you really have this version.
hi @rbri , I'm not sure how to verify the jar. Can you show me reference how to do that? On the other hand, I tried to implement the jar from within the project and it works. :smiling_face_with_tear:
maybe simply download it directly with the browser and compare the size
It works? Really?
yes, for my current test case it work, will check for my friends test case
ok will cross my fingers
Hi @rbri , it works!! 😃 So far every test case that I make for this project works without error at Android API level 25. I learn a lot from debugging this and also from your advice. Sorry if I'm not clear explaining to you Thank you very much, Terima kasih 🙏
Great, github stars are always welcome - and if you use HtmlUnit at work sponsoring also ;-)
I plan a release for the weekend but i still not sure if i really like to include the old commons-io stuff.
Is it ok if you overwrite the commons io version in your gradle build to use 2.5 instead of 2.10.0? What do you think?
And if yes i like to make another snapshot build with the 2.10.0 dependency and i like you to test this overwriting.
Starred 😄,
Gladly, I will help you to test with the new commons io version. But please do not that the latest snapshot still unable to works compared to the one with jar file
Will not touch the snapshot without your agreement.
hi @rbri ,
I try again with the snapshot from dependency
java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.<clinit>(XPathHelper.java:45) at com.gargoylesoftware.htmlunit.html.xpath.XPathHelper.isProcessingXPath(XPathHelper.java:108) at com.gargoylesoftware.htmlunit.html.DomNamespaceNode.getLocalName(DomNamespaceNode.java:88) at com.gargoylesoftware.htmlunit.html.HtmlElement.getNodeName(HtmlElement.java:412) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.addNodeToRightParent(HtmlUnitNekoDOMBuilder.java:409) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:359) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.startElement(HtmlUnitNekoDOMBuilder.java:291) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.callStartElement(HTMLTagBalancer.java:1226) at net.sourceforge.htmlunit.cyberneko.HTMLTagBalancer.startElement(HTMLTagBalancer.java:822) at net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter.startElement(DefaultFilter.java:140) at net.sourceforge.htmlunit.cyberneko.filters.NamespaceBinder.startElement(NamespaceBinder.java:278) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanStartElement(HTMLScanner.java:2811) at net.sourceforge.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2125) at net.sourceforge.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:937) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:443) at net.sourceforge.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:394) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:762) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:204) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
still the same error
FYI : implementation 'net.sourceforge.htmlunit:htmlunit-android:2.66.0-SNAPSHOT'
Hi @arifinreinaldo, the 2.66.0 release is out. Please have a look - you now have to take care of the commons-io dependency in your build. You have to overwrite the 2.10.0 dependency defined by htmlunit-android with the 2.5 one.
Please try - hope this still works for you.
Hi @rbri , I have tried wit the new 2.66.0 release
FATAL EXCEPTION: DefaultDispatcher-worker-2 Process: com.rei.webscraperkotlin, PID: 4379 java.lang.NoSuchMethodError: No static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal; or its super classes (declaration of 'java.lang.ThreadLocal' appears in /system/framework/core-oj.jar) at org.apache.commons.io.IOUtils.<clinit>(IOUtils.java:183) at org.apache.commons.io.IOUtils.read(IOUtils.java:1685) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.read(EncodingSniffer.java:1101) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.sniffHtmlEncoding(EncodingSniffer.java:550) at com.gargoylesoftware.htmlunit.util.EncodingSniffer.sniffEncoding(EncodingSniffer.java:462) at com.gargoylesoftware.htmlunit.WebResponse.getContentCharsetOrNull(WebResponse.java:172) at com.gargoylesoftware.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:178) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:219) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:690) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:592) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:510) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:417) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:555) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:537)
and I have implement implementation 'commons-io:commons-io:2.5' implementation 'net.sourceforge.htmlunit:htmlunit-android:2.66.0' anything that I have to check?
@arifinreinaldo sorry for the long story here!
The stacktrace clearly shows you are still using the wrong commons-io version.
com.gargoylesoftware.htmlunit.util.EncodingSniffer.read(EncodingSniffer.java:1101)
uses IOUtils.read()
org.apache.commons.io.IOUtils.<clinit>(IOUtils.java:183) at org.apache.commons.io.IOUtils.read(IOUtils.java:1685)
IOUtils.read() requires the class to load and therefor processes the static initializer initializing the static vars
static method withInitial(Ljava/util/function/Supplier;)Ljava/lang/ThreadLocal; in class Ljava/lang/ThreadLocal
and in the 'wrong' version of commons-io one of these variables is initialized by calling withInitial(). The code looks like this:
/**
* Internal byte array buffer.
*/
private static final ThreadLocal<byte[]> SKIP_BYTE_BUFFER = ThreadLocal.withInitial(IOUtils::byteArray);
You have to enforce using the old commons-io version (if you use gradle this page might help https://docs.gradle.org/current/userguide/dependency_downgrade_and_exclude.html) And maybe there is a view in your IDE that shows the version of all jars in use.
@arifinreinaldo can i close this?
Hi @rbri , sorry I have been busy in IRL. Yes we can close the ticket. Thanks
@arifinreinaldo - Thanks
Hi, is it possible to fork a version htmlunit that support android 7? Because I have a requirement to test in the android 7 devices. I'm planning to lower the htmlunit version library and also other supporting library. Is it possible and do you have any input which file that needs to be taken care of? Thanks