0

I need help in fixing this problem with Gradle build in Android Studio.

I want to know what's wrong with it..?

Here is my System Config

Here Is My System Config

I am using: Android studio 2.1.1 and gradle-2.14.1

My problem is that if I make just minor changes in project then it will take 5-10 min to build the projectagain.

I am also try these settings :

gradle.properties

org.gradle.daemon=true
org.gradle.parallel=true

Here is Gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.midmesolo.mindme"
        vectorDrawables.useSupportLibrary = true
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

            }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'me.zhanghai.android.materialprogressbar:library:1.1.7'
}
TTT
  • 1,848
  • 2
  • 30
  • 60
sunny
  • 179
  • 2
  • 14
  • 1
    Possible duplicate of [Android Studio Takes too long time to run the app on real device](http://stackoverflow.com/questions/38004762/android-studio-takes-too-long-time-to-run-the-app-on-real-device) – Siddharth Venu Sep 08 '16 at 11:35
  • can you post your build.gradle – linhtruong Sep 08 '16 at 11:36
  • How many and which dependencies do you have? Is instant run enabled? – simon Sep 08 '16 at 11:39
  • result updated bro see gradle build – sunny Sep 08 '16 at 11:49
  • Possible duplicate of [Android studio Gradle build speed up](http://stackoverflow.com/questions/17324849/android-studio-gradle-build-speed-up) – Ali Bdeir Sep 08 '16 at 13:30
  • Are you so lazy you dont want to google? – Ali Bdeir Sep 08 '16 at 13:30
  • Do you have an antivirus application running? Try if disabling boosts the build time and - if that is the case - add exception rules. – Frederic Klein Sep 08 '16 at 14:07
  • Possible duplicate of [Building and running app via Gradle and Android Studio is slower than via Eclipse](http://stackoverflow.com/questions/16775197/building-and-running-app-via-gradle-and-android-studio-is-slower-than-via-eclips) – Frederic Klein Sep 08 '16 at 14:15

2 Answers2

-1

Generally, gradle builds take some time, especially in Android.

You can find some useful articles regarding this issue on the Internet:

http://kevinpelgrims.com/blog/2015/06/11/speeding-up-your-gradle-builds/

https://www.timroes.de/2013/09/12/speed-up-gradle/

http://zeroturnaround.com/rebellabs/making-gradle-builds-faster/

You can reducde build time by some margin, it's usually not a revolutionary change tho.

Rybzor
  • 183
  • 3
  • 12
-1

In my build.gradle I added this line. The number 2 means 2GB.

dexOptions {
     javaMaxHeapSize "2g"
}

Note: the value here is totally optional and situational. If you have higher RAM; you can dedicate the half of it. If you have less than then stick to the default value.

Enzokie
  • 7,365
  • 6
  • 33
  • 39
  • It increase the heap allocation of your Java so that it will a have a better processing speed. – Enzokie Sep 08 '16 at 12:05
  • Just paste in in your `build.gradle` before `dependencies { }`. Btw the order doesn't matter. – Enzokie Sep 08 '16 at 12:08
  • If he has low RAM this will crash his laptop – Ali Bdeir Sep 08 '16 at 13:32
  • @AbAppletic he posted an image already that he has 4gb. Basically 2GB wont consume everything. Note: it is the developers responsibility to adjust that value, it inst compulsory to use 2gb value if the development machine is less than the capacity (You could go higher if you have better RAM size). I hope I do make sense and please justify the downvote. – Enzokie Sep 08 '16 at 13:55
  • Ok I guess its time for you to upgrade into 8Gb ram machine. – Enzokie Sep 09 '16 at 05:23