4

I checked all of the questions with answers about slow gradle build . (For Example here , here and ...) .but build gradle in my project is too slow . sometimes which building takes about 5-8 minuets , i searched in many sites , and now im tired

Build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "..."
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"

        jackOptions {
            enabled true
            additionalParameters('jack.incremental': 'true')
        }


        dexOptions {
            incremental true
            javaMaxHeapSize "4g"
        }
    }


    compileOptions {
        incremental true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/TelegramNewApiLibrary.jar')
    compile files('libs/TelegramNewConvert.jar')
}
repositories {
    mavenCentral()
}

build.gradle(Module app):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle.properties :

org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 org.gradle.parallel=true
 org.gradle.daemon = true

my Anti-Virus is disabled and work offline is enable in project.

System Ram : 4G

System CPU : 3.10 GH

Android Studio Version : 2.2.3

any one can help me ?

Community
  • 1
  • 1
MrNadimi
  • 1,424
  • 4
  • 18
  • 33
  • 1
    Generate a build scan (https://plugins.gradle.org/plugin/com.gradle.build-scan) or at least run with the --profile option, to find *what* is slow, and what should be improved. – JB Nizet Mar 05 '17 at 09:14
  • 1
    :app:transformJackWithJackForDebug >> this is slow . i think its for jack option – MrNadimi Mar 05 '17 at 09:52
  • I don't know much about android, and have no idea what this dask is for, or what it does. But if that is slow, do you really have a gradle slowness problem? Or do you have a jack transformation slowness problem? – JB Nizet Mar 05 '17 at 09:55
  • my gradle build in other project finished in 2 minuets . but in jack transformation is finished in 6_7_10 minuets – MrNadimi Mar 05 '17 at 09:59

2 Answers2

0

Understand that Gradle Build has nothing to do with your CPU Speed or RAM. The reason why the Build gets slower in your PC is due to your Internet Connection. The build can take nearly ~100 MB approx. of data to complete it's process. Even if your Internet Connection is fast and your connection's PING speed is slow, it takes more time. Thanks for your time.

0

Try to update AndroidStudio to 3.0, upgrade gradle gradle:2.2.3 => gradle:3.0.0 and buildtools buildToolsVersion '25.0.2' => buildToolsVersion '26.0.2'

Denys Lobur
  • 124
  • 5