簡體   English   中英

與HttpClient和SDK v23的兼容性

[英]Compatibility with HttpClient and SDK v23

首先,我為我的英語不好表示歉意。 我的問題是我無法協調在不同版本的Android上運行的兩個代碼,因為它們分別是:

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

如果我將項目設置為版本22,則它只能使用HTTPClient,但是將其更改為23則不能識別它,但是可以使用AppIntro。 附件“ build.gradle”和每種情況下的錯誤輸出。 具有諷刺意味的是,我倆必須一起工作,因為它們非常適合我的項目

    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

預先非常感謝您,希望對我有幫助

從Android L開始,Google不再維護Apache HTTP庫。 他們專注於URLConnection Java API。

幸運的是,始終可以通過在gradle腳本中放置useLibrary 'org.apache.http.legacy'在API23 +上使用Apache HTTP庫:

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

Android 6.0的更改-刪除Apache HTTP客戶端

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM