Vincent Chao
Vincent Chao

Reputation: 43

How to import org.apache in android studio?

I downloaded components-client-android-4.3.5.1.zip file. But no jar file can import. How to import all java file in android Studio. please tell me detailed steps. Thank your help. p.s I am a beginner so I am not good at programming. Thank your help.

Upvotes: 1

Views: 13534

Answers (4)

Frøst
Frøst

Reputation: 5

check this image

Write The Code To In "build.gradle" File

compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'

Upvotes: 0

Sagar Chavada
Sagar Chavada

Reputation: 5269

HttpClient is not supported any more in sdk 23. You have to use URLConnection or downgrade to sdk 22 (compile 'com.android.support:appcompat-v7:22.2.0')

If you need sdk 23, add this to your gradle:

android {
    useLibrary 'org.apache.http.legacy'
}

You also may try to use OkHttp instead

and also if you want to use this dependecy..

compile 'org.apache.httpcomponents:httpmime:4.3.5'

then also change class path version.. so you can overcome ambiguity problem.

classpath 'com.android.tools.build:gradle:1.3.0' 

Upvotes: 3

Aparajita Sinha
Aparajita Sinha

Reputation: 524

Add this to build.gradle (Module:app) compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'

Upvotes: 0

Shaishav Jogani
Shaishav Jogani

Reputation: 2121

Add this in your build.gradle file

compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'

No jar file require.

Upvotes: 0

Related Questions