0

I get this when I try to build the application. Does this have to do with the 65k method limitation? I have already put in the multiDexEnabled true under default config and compile 'com.android.support:multidex:1.0.0' under dependencies?

AGPBI: {"kind":"simple","text":"UNEXPECTED TOP-LEVEL ERROR:","sources":[{}]}
AGPBI: {"kind":"simple","text":"java.lang.OutOfMemoryError: Java heap space","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.SsaBasicBlock.\u003cinit\u003e(SsaBasicBlock.java:124)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:147)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:173)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:103)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:44)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:297)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:729)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.access$300(Main.java:83)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:632)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:505)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.runMultiDex(Main.java:334)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.run(Main.java:244)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat com.android.dx.command.Main.main(Main.java:106)","sources":[{}]}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 3

build.gradle

apply plugin: 'com.android.application'
apply plugin: 'android'

artifacts.add("default", file('gson-2.3.1.jar'))

dependencies {
    compile files('libs/gson-1.6.jar')
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.squareup:android-times-square:1.5.0@aar'
    compile 'com.google.code.gson:gson:1.6'
    compile 'com.github.alamkanak:android-week-view:1.2.1'
    compile files('libs/aniqroid.jar')
    compile files('libs/joda-time-2.8.2.jar')
    compile project(':fileChooser')
    compile 'com.github.PhilJay:MPAndroidChart:v2.0.9'
    compile 'com.github.citux:datetimepicker:0.1.2'
    compile 'com.github.gcacace:signature-pad:1.0.1'
    compile files('src/main/resources/commons-io-2.4.jar')
    compile files('src/main/resources/commons-io-2.4-javadoc.jar')
    compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
    compile files('libs/jackson-core-2.5.0.jar')
    compile 'com.facebook.stetho:stetho:1.3.0'
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.0'
    compile 'com.facebook.stetho:stetho-js-rhino:1.3.0'
    compile 'com.android.support:multidex:1.0.0'
}
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "cimsmobile.lexcom.com"
        minSdkVersion 14
        targetSdkVersion 21
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}
repositories {
    maven { url "https://jitpack.io" }
}

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}
null
  • 713
  • 2
  • 8
  • 30
  • Why would you include the **entire** support library AND the **entire** play service library? Cant imagine you need all of it – Tim Feb 02 '16 at 23:03
  • Your error looks like Gradle ran out of heap space: http://stackoverflow.com/questions/30045417/android-studio-gradle-could-not-reserve-enough-space-for-object-heap – CommonsWare Feb 02 '16 at 23:23

1 Answers1

1

Google play services is huge and you likely don't need all the API's in it you should only compile the google play services that you need and not use

multiDexEnabled true

this can cause compile problems, unless you absolutely need it but most people tend to just enable this without getting to the root of the problem.

please navigate to root of the project in terminal in android studio and do:

 ./gradlew app:dependencies

This will list out all the dependencies your are compiling in your app and chances are you have multiple duplicates considering the number of libraries you are depending on.

the list of google play services is located here under Selectively compiling APIs into your executable

kandroidj
  • 13,784
  • 5
  • 64
  • 76