Building and launching an application through Gradle and Android Studio 2.0 is slower

I have a multi-project (2 modules), of which the building takes about 1/2 minute each time. When I click Run in Android Studio, I have to wait every time to rebuild the application, which is very slow. It took 6/8 minutes each time.

enter image description here

Can I automate the build process in Android Studio? Or do you have tips on how to make this process faster?

here is my build.gradle file (application module):

allprojects { repositories { mavenCentral() maven { url "https://jitpack.io" } maven { url 'http://clinker.47deg.com/nexus/content/groups/public' } } } apply plugin: 'com.android.application' dependencies { compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0' compile fileTree(dir: 'libs', include: '*.jar') compile('com.fortysevendeg.swipelistview:swipelistview: 1.0-SNAPSHOT@aar ') { transitive = true } compile 'com.android.support:multidex:1.0.1' compile 'com.github.nirhart:parallaxscroll:1.0' compile 'com.github.amlcurran.showcaseview:library:5.0.0' compile 'com.android.support:support-v4:22.0.1' compile 'com.android.support:appcompat-v7:22.0.1' compile 'com.android.support:design:22.2.+' compile 'com.rengwuxian.materialedittext:library:2.1.4' compile 'com.nineoldandroids:library:2.4.0' compile 'com.daimajia.easing:library: 1.0.1@aar ' compile 'com.daimajia.androidanimations:library: 1.1.3@aar ' compile 'com.pnikosis:materialish-progress:1.7' compile 'com.github.fenjuly:ArrowDownloadButton:9e15b85e8a' compile 'ch.acra:acra:4.5.0' compile 'com.yalantis:contextmenu:1.0.5' compile project(':locationlib') } configurations { compile.exclude group: 'javax.inject', module: 'javax.inject' } android { compileSdkVersion 22 buildToolsVersion '22.0.1' compileOptions { encoding "UTF-8" sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } lintOptions { abortOnError false } dexOptions { javaMaxHeapSize "8g" jumboMode true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/license.txt' exclude 'META-INF/LGPL2.1' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/notice.txt' exclude 'META-INF/INDEX.LIST' exclude 'META-INF/ASL2.0' } defaultConfig { targetSdkVersion 22 renderscriptTargetApi 19 renderscriptSupportModeEnabled false multiDexEnabled true } productFlavors { } afterEvaluate { tasks.matching { it.name.startsWith('dex') }.each { dx -> if (dx.additionalParameters == null) { dx.additionalParameters = [] } dx.additionalParameters += '--multi-dex' } } } 

My laptops I3 8 GB RAM and Windows 10 64 bit.

Actually I have Android Studio 2.0 preview 9 with this studio64.exe.vmoptions

 -Xms256m -Xmx1280m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:-OmitStackTraceInFastThrow -Djna.nosys=true -Djna.boot.library.path= -Djna.debug_load=true -Djna.debug_load.jna=true -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Didea.paths.selector=AndroidStudioPreview2.0 -Didea.platform.prefix=AndroidStudio 

A Work Gradle OFFLINE

+7
android android-studio gradle
source share
2 answers

You should use Android Studio 1.5.1 , which is much faster than the previous version of Android Studio.

+1
source share

The 47deg maven repository is very slow. Your best alternative is to find a way to resolve the dependencies they provided elsewhere and remove this line from your repository body:

 maven { url 'http://clinker.47deg.com/nexus/content/groups/public' } 

Build time will be significantly reduced.

0
source share

All Articles