0

I'm trying to install the google api java client for android

according to the documentation, it should be easy, just add this 2 lines to your build.gradle file:

repositories {
    mavenCentral()
}
dependencies {
    compile 'com.google.api-client:google-api-client:1.20.0'
}

this is how my build gradle file looks like:

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

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



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1-alpha1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.android.support:design:22.2.1'
    compile 'com.google.api-client:google-api-client-android:1.20.0' exclude module: 'httpclient'
}

but when I try to run it I get an error:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

following this post:

I tried to clean, and added the folowing lines into my file:

defaultConfig {
    multiDexEnabled true
}

but now the build just takes a long time and still ends up with an error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Daniel Katzan
  • 526
  • 1
  • 7
  • 29

0 Answers0