1

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.

1
  • Why are you including json? Json comes with Android. Commented Oct 4, 2015 at 7:43

3 Answers 3

1

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'
}
Sign up to request clarification or add additional context in comments.

4 Comments

Can you post you build.gradle file?
i posted my gradle file as answer
Change targetSdkVersion to 23 and everything will be good to go. Apache API were removed in Android API 23. They were depricated in Android API 22. That is why the warning.
Did that remove the warning?
1

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

Comments

0

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'

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.