nicolas asinovich
nicolas asinovich

Reputation: 3511

openjdk platform binary use so much memory when build android app

When I build android app it can take from 5 minutes to 15 minutes. How to solve problem whith memory. Is there a way to reduce memory consumption? How make build faster?

my build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.xxx.xxx"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile('com.philliphsu:bottomsheetpickers:2.3.3') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.android.support', module: 'gridlayout-v7'
    }

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:gridlayout-v7:25.3.1'
    compile 'com.philliphsu:bottomsheetpickers:2.3.3'
    compile 'com.vk:androidsdk:1.6.8'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}

also my gradle.properties

org.gradle.jvmargs=-Xmx1536m
org.gradle.daemon=true
org.gradle.parallel=true

also add report enter image description here

Why it takes so long and how you can speed up the assembly of the project?

Upvotes: 8

Views: 14611

Answers (2)

Numan Gillani
Numan Gillani

Reputation: 499

Everyone will give different different opinions, but I recently fixed it by disabling my Antivirus Software. Disable the firewall, because it interrupts the Gradle Daemon from starting so OpenJDK Platform binary will be keep executing again n again, ultimately the memory out of crash will happen for the system.

UPDATE: Make sure, Wireless Hotspot is Turned Off. That's most important, while building the Project, the Hotspot must not be On.

Do this, and Thanks me later 💖

Starting Gradle Daemon...

Gradle Daemon started in 4 s 291 ms

Starting Gradle Daemon...

Gradle Daemon started in 5 s 664 ms

Starting Gradle Daemon...

Gradle Daemon started in 2 s 210 ms

Starting Gradle Daemon...

Gradle Daemon started in 7 s 258 ms

Upvotes: 7

nicolas asinovich
nicolas asinovich

Reputation: 3511

Solution - not using Jack. Read here https://developer.android.com/studio/preview/features/java8-support.html

Thanks @BladeCoder

Upvotes: 3

Related Questions