Getting NoSuchFieldError INSTANCE org/apache/http/message/BasicHeaderValueParser
Unfortunately stock versions of HttpCore cannot be used in Android. Please use Apache HttpClient Android Port which also includes requisite HttpCore classes
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
NoSuchFieldError INSTANCE at org.apache.http.impl.io.DefaultHttpRequestWriterFactory
org.apache.httpcomponents:httpcore:4.1 -> 4.3.3
means 4.1
is the requested version, which is resolved to 4.3.3
by conflict resolution. Executing something like gradle -q dependencyInsight --configuration compile --dependency httpcore
should give you more insight on this.
You should check the build output, and see what jars are actually packaged with your app. Also, using some file manager run a search for BasicLineFormatter.class
through the build output (including archives, of course), this should give you a definite answer what jars contain what version of this class.
If there is only one version (4.3.3) this must mean that the other version comes from the container that's running your app. Ways of resolving this depend on the container.
If you do find multiple versions, you can try excluding transitive dependency to httpcore
globally in the project (chapter 51.4.7 of user guide).
If you define an exclude for a particular configuration, the excluded transitive dependency will be filtered for all dependencies when resolving this configuration or any inheriting configuration.
unable to resolve Apache HTTP library to send Request and Receive Response
Unfortunately stock versions of HttpCore cannot be used in Android. Please use Apache HttpClient Android Port which also includes requisite HttpCore classes
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
MultipartEntityBuilder to send pictures to rail server
Try using httpmime version 4.3.6
I tried using 4.4+ but always the same problem.
Getting Failed resolution of: Lorg/apache/http/impl/nio/reactor/DefaultConnectingIOReactor When trying to implement a Unirest API from RapidAPI
I believe you missed one of those Apache dependencies (httpasyncclient
in your case I suppose).
There are actually three of them as mentioned by the documentation:
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
So, go to this link download-add the jar file manually inside your project:
http://hc.apache.org/downloads.cgi
And look for: HttpAsyncClient
.
Use this to add jar
file-library inside your project: How to add a jar in External Libraries in android studio
Related Topics
List View Items Changes Position When Scrolling Android
Using the Limit Statement in a SQLite Query
How to Change Fragment's Textview's Text from Activity
Change Keyboard Input Language
Inflate a View/Layout into Another Layout
Sqliteopenhelper Onupgrade() Confusion Android
How to Call Rest API from an Android App
Where/How to Getintent().Getextras() in an Android Fragment
How to Use Front and Back Camera at Same Time in Android
How to Unregister Broadcastreceiver
How Does Native Android Code Written for Arm Run on X86
What Is Setcontentview(R.Layout.Main)
Java.Lang.Noclassdeffounderror: Android.Support.V7.Appcompat.R$Styleable