0

I have a class with more than 30 Packages and more than 200 Java Files(including all packages). Each time when i run the project in Android Studio, the Gradle in taking more or less around 10 to 13 minutes. I am using the Android Studio 2.1.2 and Gradle version 2.10. Regarding the dependencies i am using 26 dependencies(2 as project-compile project(':libproject'),13 as files-compile files('libs/httpmime-4.2.6.jar') and the rest like compile 'com.google.android.gms:play-services-location:8.3.0').

My Projects gradle file looks like this

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

allprojects {
repositories {
    jcenter()
}
}

I googled this and got a modified the app gradle file and it looks somwthing like this

defaultConfig {
    applicationId "palmagent.Main.Three"
    minSdkVersion 9
    targetSdkVersion 23
    multiDexEnabled true
}

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
    jumboMode = true
}

My question is that whether the size of the project slows down the gradle or if there is someother issue?

Instant run helps but it gave up when generating signed APK.

I also wonder if my PC configuration is a reason. I am using Windows 8 PRO Intel Core(TM)2 Dup CPU 5 GB RAM 64 bit OS,x64 bassed Processor.

The same project when building in a PC with Linux generates APK faster.

Also I have 60 product flavors. So when generating the APK for each flavor i have to wait for 15 mins(only in windows) which makes this a big deal for me.

Please someone help me with a solution.

David
  • 906
  • 3
  • 11
  • 23
  • compilation takes time with that many classes 10-13 minutes seems reasonable. I don't see the need to compile a project every few minutes. – rahul tyagi Aug 03 '16 at 11:29
  • Solution is upgrading your RAM to 16GB and use SSD – anhtuannd Aug 03 '16 at 11:43
  • @rahultyagi Please read the question fully. The same project gets compiled in a PC with Linux in 4- 5 mins. And also i want to reduce the time only while APK generation. At other times i will make use of Instant run. – David Aug 03 '16 at 11:44
  • I dont think its a valid question anyway as to why 15 mins is such a big problem – rahul tyagi Aug 03 '16 at 18:36
  • @anhtuannd Thanks for the answer. But a PC with Ubuntu with the same CPU and RAM configuration as mentioned above takes the build in 4-5 mins. I don't think OS is the reason for this delay, but if it is then please guide me. – David Aug 04 '16 at 01:32
  • @rahultyagi This may or may not be a valid question, but I think you don't have a solution for this. Not a problem. And also, I have 60 product flavors and I think 15 minutes for every flavor is a big deal for me. Same configuration PC with Ubuntu takes the build in 5 mins. I want to know the reason for this variation of time. Please give a solution to solve the issue not to get on with it. Good or bad anyway thanks for your reply. – David Aug 04 '16 at 01:33
  • @David http://stackoverflow.com/questions/25006075/extremely-long-build-with-gradle-android-studio seems related – rahul tyagi Aug 04 '16 at 10:46
  • @rahultyagi I have tried that too..I have added the same code in my question too..but no luck. – David Aug 04 '16 at 10:49

0 Answers0