question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR in Android - NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier

See original GitHub issue

Hi. Im sorry, but I’ve been trying to solve this problem for a while now and I really need help because this is frying by brain and eyes. So I would love to have some help.

The error:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: paulor.nutritiontrackerkotlin, PID: 25944
    java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes2.dex)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
        at com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory(HtmlUnitSSLConnectionSocketFactory.java:89)
        at com.gargoylesoftware.htmlunit.HttpWebConnection.configureHttpsScheme(HttpWebConnection.java:670)
        at com.gargoylesoftware.htmlunit.HttpWebConnection.createHttpClientBuilder(HttpWebConnection.java:588)
        at com.gargoylesoftware.htmlunit.HttpWebConnection.getHttpClientBuilder(HttpWebConnection.java:544)
        at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:173)
        at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1597)
        at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1519)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:498)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:413)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:551)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:533)
        at paulor.nutritiontrackerkotlin.MainActivityViewModel.getFood(MainActivity.kt:97)
        at paulor.nutritiontrackerkotlin.fragments.HomeFragment.onCreateView$lambda-0(HomeFragment.kt:26)
        at paulor.nutritiontrackerkotlin.fragments.HomeFragment.$r8$lambda$oLhVoC0TON1oPmPiWZ-31sqsrqE(Unknown Source:0)
        at paulor.nutritiontrackerkotlin.fragments.HomeFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
        at android.view.View.performClick(View.java:6294)
        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1131)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
        ```

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Feb 19, 2022

Technically there is no difference and you can stay with the android version - it is exactly the same code as the ‘real’ htmlunit. But there is some flexibility you are loosing because the httpclient is (shaded) included in your jar file and no longer an separate jar. This might be a problem for some users.

Will close this issue for now and update the readme a bit.

If you like you can have a look at the htmlunit-android readme and report open questions or suggestions.

1reaction
rbricommented, Feb 18, 2022

you have to add the snapshot repo and i just made a fix. Please use 2.58.0-SNAPSHOT

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoSuchFieldError: No static field INSTANCE of type Lorg ...
There reason for this error is a class version clash between HtmlUnit (using HttpClient) and and the version of the HttpClient partly integrated ......
Read more >
No static field INSTANCE of type Lorg/apache/http/conn/ssl ...
Crash when I try to make a Wikidata query java.lang.NoSuchFieldError: No static field INSTANCE of type ...
Read more >
java.lang.NoSuchFieldError: No static field [37120862]
Getting the following error in Android Studio console: Process: com.Expion.Expion, PID: 7495 java.lang.NoSuchFieldError: No static field ...
Read more >
AmazonSQSClientBuilder.defaultClient() Java.lang ...
AmazonSQSClientBuilder.defaultClient() Java.lang.NoSuchFieldError: No Static Field INSTANCE Of Type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier · Solution ...
Read more >
How to Resolve the NoSuchFieldError in Java - Rollbar
The NoSuchFieldError is an error in Java that occurs when a ... of an object or a static field of a class but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found