简体   繁体   中英

Compatibility with HttpClient and SDK v23

first I apologize for my bad English . My problem is I can not reconcile two codes that run on different versions of Android, as they are:

    import org.apache.http.client.HttpClient; (This work with 22)
    import com.github.paolorotolo.appintro.AppIntro;(This work with 23)

If I set my project to version 22 , it works only HTTPClient , but changing to 23 does not recognize it , but it works the AppIntro . Attachment " build.gradle " and the error output in each case . I have to work with both because they are perfectly suited to my project , ironically

    apply plugin: 'com.android.application'

    android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.victo.cqbo_definitive"
    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'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.github.paolorotolo:appintro:3.4.0'
}


Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\victo\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

Thank you very much in advance, I hope will help me with a solution c

Starting with Android L, Google is not maintaining anymore the Apache HTTP Library. They focused on the URLConnection Java API.

Fortunately it's always possible to use the Apache HTTP Library on API23+ by putting useLibrary 'org.apache.http.legacy' on the gradle script :

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    useLibrary 'org.apache.http.legacy'
    ...
}

Android 6.0 Changes - Apache HTTP Client Removal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM