Manish
Manish

Reputation: 29

i get executionexception and large heap error

For faster builds, increase the maximum heap size for the Gradle daemon to more than 3072 MB.

To run dex in process, the Gradle daemon needs a larger heap.

To do this set org.gradle.jvmargs=-Xmx3072M in the project gradle.properties. It currently has approximately 989 MB.

For more information see https://docs.gradle.org/current/userguide/build_environment.html Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_102\bin\java.exe'' finished with non-zero exit value 1 :app:transformClassesWithDexForDebug FAILED

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "videoplayer.avkinfosoft.com.videoplayer"
        minSdkVersion 11
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled  true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "2g"
    }
    packagingOptions
            {
                pickFirst 'META-INF/license.txt'
                exclude 'META-INF/DEPENDENCIES'
                exclude 'META-INF/NOTICE'
                exclude 'META-INF/LICENSE'
                exclude 'META-INF/LICENSE.txt'
                exclude 'META-INF/NOTICE.txt'
            }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.google.firebase:firebase-ads:9.4.0'
}

gradle.propties

Project-wide Gradle settings.

IDE (e.g. Android Studio) users: Gradle settings configured through the IDE will override any settings specified in this file.

For more details on how to configure your build environment visit http://www.gradle.org/docs/current/userguide/build_environment.html

Specifies the JVM arguments used for the daemon process. The setting is particularly useful for tweaking memory settings. Default value: -Xmx10248m -XX:MaxPermSize=256m org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

When configured, Gradle will run in incubating parallel mode. This option should only be used with decoupled projects. More details, visit http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects org.gradle.parallel=true

org.gradle.jvmargs=-Xmx1024m

org.gradle.daemon=true

When configured, Gradle will run in incubating parallel mode. This option should only be used with decoupled projects. More details, visit

http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects org.gradle.parallel=true

org.gradle.configureondemand=true

manifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:theme="@style/AppTheme"
    tools:replace="android:theme,android:icon">

after chnage error

    dexOptions {
        javaMaxHeapSize "2g"
    }

Error:Error: A fatal exception has occurred. Program will exit.

Error:Error: A fatal exception has occurred. Program will exit.

Error:Error: A fatal exception has occurred. Program will exit.

Error:Error: Could not create the Java Virtual Machine.

Error:Error: Could not create the Java Virtual Machine.

Error:Invalid maximum heap size: -Xmx4g

Error:The specified size exceeds the maximum representable size.

For more information see https://docs.gradle.org/current/userguide/build_environment.html

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException:

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program

Files\Java\jdk1.8.0_102\bin\java.exe'' finished with non-zero exit value 1

Error:Error: A fatal exception has occurred. Program will exit.

Error:The specified size exceeds the maximum representable size.

Error:Invalid maximum heap size: -Xmx4g

Error:Error: Could not create the Java Virtual Machine.

Error:The specified size exceeds the maximum representable size.

Error:Invalid maximum heap size: -Xmx4g

To do this set org.gradle.jvmargs=-Xmx5120M in the project gradle.properties.

Error:The specified size exceeds the maximum representable size.

Error:The specified size exceeds the maximum representable size.

Error:Invalid maximum heap size: -Xmx4g

Error:Error: Could not create the Java Virtual Machine. :app:transformClassesWithDexForDebug FAILED

Error:Error: A fatal exception has occurred. Program will exit.

Error:Error: Could not create the Java Virtual Machine.

Error:Invalid maximum heap size: -Xmx4g

It currently has approximately 989 MB.

For faster builds, increase the maximum heap size for the Gradle daemon to more than 5120 MB.

To run dex in process, the Gradle daemon needs a larger heap.

Upvotes: 0

Views: 516

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

You should add javaMaxHeapSize in build.gradle section .

android {
compileSdkVersion //
buildToolsVersion //


dexOptions {
    javaMaxHeapSize "4g"
}

You can visit for more information Android Gradle: What is javaMaxHeapSize “4g”?

Upvotes: 1

RoHiT
RoHiT

Reputation: 372

Add android:largeHeap="true" in your MenifestFile in application tag.

Upvotes: 2

Related Questions