【问题标题】:Dependency httpclient - AndroidStudio依赖 httpclient - AndroidStudio
【发布时间】:2023-03-07 01:01:01
【问题描述】:

我的 Android Studio 中的 rundebug 按钮被禁用。 我已经看到了很多关于此的答案,但在我的情况下解决方案不正确。 这是我在我的 gradle 控制台中的错误:

WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.

这是我的build.gradle

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.2"

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

repositories {
    mavenCentral()
    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }
    maven { url "https://jitpack.io" }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.2.0'

    // Zxing libraries Scan
    compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
    compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
    compile 'com.google.zxing:core:3.0.1'

    //Google api books
    compile 'com.google.apis:google-api-services-books:v1-rev80-1.21.0'
    compile 'com.google.android.gms:play-services-appindexing:9.4.0'

    // Dependency for Google Sign-In
    compile 'com.google.android.gms:play-services-plus:9.4.0'
    compile 'com.google.android.gms:play-services-auth:9.4.0'

    //Facebook Login
    compile 'com.facebook.android:facebook-android-sdk:4.13.2'

    // Dependency for Firebase
    compile 'com.google.firebase:firebase-messaging:9.4.0'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-storage:9.4.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'


}



dependencies {
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
}
apply plugin: 'com.google.gms.google-services'

非常感谢您的帮助

【问题讨论】:

  • 您是否为http-client 添加了任何依赖项?
  • 不,我已经删除了 okhttpclient。但我没有用那个

标签: android android-studio android-gradle-plugin httpclient build.gradle


【解决方案1】:

您需要在 build.gradle 文件中排除 dependencies

compile('com.google.apis:google-api-services-books:v1-rev80-1.21.0') {
    exclude module: 'httpclient' 
    exclude group: 'org.apache.httpcomponents' 
    exclude group: 'org.apache.httpcomponents', module: 'httpclient' 
}

尝试从所有配置中排除它。

configurations {
    compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}

重新启动工作室,然后再次检查。或者从“运行”按钮旁边的下拉菜单中选择应用模块。

【讨论】:

  • 这又是同样的问题。但现在还有“ApplicationTest.java 使用或覆盖了已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以了解详细信息。”
  • 现在没有错误但是运行和调试按钮被禁用了。
  • @Carlo 重新启动工作室,然后再次检查。或者从“运行”按钮旁边的下拉菜单中选择应用模块。
猜你喜欢
  • 2013-09-10
  • 1970-01-01
  • 1970-01-01
  • 2019-07-05
  • 2017-12-26
  • 1970-01-01
  • 1970-01-01
  • 2016-09-16
  • 1970-01-01
相关资源
最近更新 更多