繁体   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