Home Building and running app via Gradle and Android Studio is slower than via Eclipse
Reply: 0

Building and running app via Gradle and Android Studio is slower than via Eclipse

user10983
1#
user10983 Published in September 19, 2018, 11:24 am

I have a multi-project (~10 modules) of which building takes about 20-30 seconds each time. When I press Run in Android Studio, I have to wait every time to rebuild the app, which is extremely slow.

Is it possible to automate building process in Android Studio? Or do you have any advice on how to make this process faster?

In Eclipse, thanks to automatic building, running the same project on an emulator takes about 3-5 seconds.

This is my build.gradle file (app module):

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':libraries:SharedLibs')
    compile project(':libraries:actionbarsherlock')
    compile project(':libraries:FacebookSDK')
    compile project(':libraries:GooglePlayServices')
    compile project(':libraries:HorizontalGridView')
    compile project(':libraries:ImageViewTouch')
    compile project(':libraries:SlidingMenu')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }
}
share|improve this question
  • 22
    Please bear in mind that neither the Gradle-based build system nor Android Studio are production-grade at this time. – CommonsWare May 27 '13 at 15:02
  • 11
    The time being spent here is most likely in the DEXing phase. Unfortunately, android studio's make seems to perform a clean every single time, causing the previously dex'd files to be deleted. Hopefully, we'll see an incremental build fix soon. – Richard J. Ross III Jun 8 '13 at 20:17
  • 3
    In the meantime, is there any simple way of telling changing the default Gradle tasks such that they do not always perform a clean? – sigmabeta Oct 28 '13 at 14:16
  • 10
    @CommonsWare well, there is no excuse now we are on version 1.02, but its still a major issue. With Android studio running my 4GB quad core laptop uses about 3.75gb of its ram just holding a single instance of a hello world project. It is also as a result very sluggish. To me that indicates a serious and on going design flaw. I hope things are resolved soon. – Andrew S Jan 27 '15 at 0:52
  • 7
    @AndrewS I find it a pity we need to change our OS just to get gradle to run at a reasonable speed compared to the previous tools. – Richard Le Mesurier Jul 22 '15 at 12:08

27 Answers 27

active oldest votes
up vote 429 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.432539 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO