scionoftech
scionoftech

Reputation: 618

Apache http client error with json version provided by android

I am trying to parse json from url, Apache http client removed from Android API level 23. If I use httpclient.jar files in android studio, it shows error like:

"Warning:Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android."

dependencies{

    compile files('libs/httpclient-4.5.1.jar')
    compile files('libs/httpcore-4.5.1.jar')
}

How to resolve this error.

Thank you.

Upvotes: 1

Views: 1827

Answers (3)

scionoftech
scionoftech

Reputation: 618

this is my gradle file

apply plugin: 'com.android.application'

android { compileSdkVersion 22 buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies{

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.github.nkzawa:engine.io-client:0.6.0'
compile 'com.github.nkzawa:socket.io-client:0.6.0'
compile 'com.github.rey5137:material:1.2.1'
compile files('libs/volley.jar')
compile files('libs/httpclient-4.5.1.jar')
compile files('libs/httpcore-4.5.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'

}

Upvotes: 0

xxxzhi
xxxzhi

Reputation: 481

if you just want to use apache client in sdk23. doDo you try to useadd this code in gradle.

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

see HttpClient won't import in Android Studio

Upvotes: 1

Akash Singh
Akash Singh

Reputation: 751

Remove the above two statements from your build.gradle and add the following dependency

dependencies {
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}

Upvotes: 1

Related Questions