Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency apache HTTP client in android with Google APIs

I have been using the google play services libraries just with Google+ login and it worked fine but now I want to include the Calendar API to my app. I am following this tutorial

The problem is that the dependencies with the new instructions of the tutorial cause a Warning in the Gradle Build.

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources]
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
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkDebugManifest
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex100Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
Information:2 warnings
:app:mergeDebugAndroidTestResources UP-TO-DATE
Information:See complete output in console
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
Information:BUILD SUCCESSFUL
:app:generateDebugAndroidTestSources UP-TO-DATE
:app:processDebugAndroidTestResources UP-TO-DATE
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
Information:0 errors
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
Information:Total time: 10.856 secs
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:mergeDebugAndroidTestAssets UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareDebugDependencies
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:processDebugAndroidTestManifest UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE

Here is my gradle app file:

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('C:/Users/Julio/.android/debug.keystore')
            storePassword 'android'
        }
    }
    compileSdkVersion 22
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.example.julio.competicionpartido"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile ('com.google.api-client:google-api-client:1.20.0'){
        exclude module: 'httpclient' 
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'org.apache.httpcomponents', module: 'httpclient' 
    }
    compile 'com.google.api-client:google-api-client-android:1.20.0'
    compile 'com.google.api-client:google-api-client-gson:1.20.0'
    compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0'
}

I have been searching for ages and I've tried everything. Could anyone help me?

like image 606
juliocb92 Avatar asked Dec 08 '22 01:12

juliocb92


1 Answers

in order to exclude that class from all the configurations:

configurations.all() {
    exclude group: "org.apache.httpcomponents", module: "httpclient"
}

dependencies {
    ...
}
like image 86
Martin Zeitler Avatar answered Dec 11 '22 09:12

Martin Zeitler