BorderCloud / SPARQL-JAVA

Client SPARQL 1.1 (very simple) for Java
Other
9 stars 6 forks source link

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier #2

Closed langsmith closed 6 years ago

langsmith commented 6 years ago

Crash when I try to make a Wikidata query

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)
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:146) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:964)
langsmith commented 6 years ago

https://stackoverflow.com/a/32313284

https://github.com/marvin-we/steem-java-api-wrapper/issues/146

https://stackoverflow.com/questions/27366430/getting-nosuchfielderror-instance-org-apache-http-message-basicheadervalueparser

langsmith commented 6 years ago

The crash is in the Endpoint class https://github.com/BorderCloud/SPARQL-JAVA/blob/805483e559c0ba69a9b07a7552031329ba444c6f/src/com/bordercloud/sparql/Endpoint.java#L379

BorderCloud commented 6 years ago

I found this doc http://hc.apache.org/httpcomponents-client-4.3.x/android-port.html

You need to use in android this line for http-client in grable :

dependencies {
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
BorderCloud commented 6 years ago

I made a new version for android (only get for the moment). https://github.com/BorderCloud/SPARQL-ANDROID

langsmith commented 6 years ago

Great, thank you @BorderCloud !

jigarfumakiya commented 6 years ago

no i have still error

that my Logcat

12:50:56.780 6465-6586/com.creativeera.google.mutalfunds E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.creativeera.google.mutalfunds, PID: 6465 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:325) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: java.lang.NoSuchFieldError: No 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.(SSLConnectionSocketFactory.java:146) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.getSocketFactory(SSLConnectionSocketFactory.java:174) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:114) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:121) at com.mashape.unirest.http.options.Options.refresh(Options.java:72) at com.mashape.unirest.http.options.Options.(Options.java:46) at com.mashape.unirest.http.options.Options.getOption(Options.java:42) at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:151) at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131) at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68) at com.creativeera.google.mutalfunds.MainActivity$getapi.doInBackground(MainActivity.java:50) at com.creativeera.google.mutalfunds.MainActivity$getapi.doInBackground(MainActivity.java:41) at android.os.AsyncTask$2.call(AsyncTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)  at java.lang.Thread.run(Thread.java:761) 

BorderCloud commented 6 years ago

It"s not the same error. You need to create a new issue and show how to reproduce this error (with an accessible endpoint and query).

waning007 commented 6 years ago

no i have still error too that my logcat

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I use implementation files('libs/httpcore-4.4.1.jar') ,but is must

BorderCloud commented 6 years ago

@waning007 you need to use https://github.com/BorderCloud/SPARQL-ANDROID for Android. Android doesn't support httpcore.

babyeldhose commented 6 years ago

08-15 12:33:29.028 10731-10731/ai.nuralogix.nura E/AndroidRuntime: FATAL EXCEPTION: main Process: ai.nuralogix.nura, PID: 10731 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.(SSLConnectionSocketFactory.java:146) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:966) at com.maxmind.geoip2.WebServiceClient.(WebServiceClient.java:139) at com.maxmind.geoip2.WebServiceClient.(WebServiceClient.java:100) at com.maxmind.geoip2.WebServiceClient$Builder.build(WebServiceClient.java:257) any one know what is the issue

BorderCloud commented 6 years ago

@babyeldhose Do you test for Android this lib https://github.com/BorderCloud/SPARQL-ANDROID ?