1

I am using Android Studio version 1.5. Building an apk takes a lot of time(almost 10-15 min). I am running studio in Windows 8.0 with 4GB RAM and 500GB Hard Disk Space. Here is the build.gradle of the app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 6
        versionName "1.0.3"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.rengwuxian.materialedittext:library:2.1.3'
    compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
    compile 'com.google.android.gms:play-services-maps:8.3.0'
    compile 'com.google.android.gms:play-services-location:8.3.0'
    compile 'com.github.rey5137:material:1.2.1'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.github.dexafree:materiallist:3.0.1'
    compile('com.mikepenz:materialdrawer:3.1.2@aar') {
        transitive = true
    }

}

I've set multidexEnabled to true but the problem persists. Please help.

div
  • 1,475
  • 3
  • 22
  • 32
  • 1
    Settings `multidexEnabled` is your issue. You have too many dependencies. If you are using `app-compat` you do not need `'com.rengwuxian.materialedittext:library:2.1.3'`, `'com.github.navasmdc:MaterialDesign:1.5@aar'`, `'com.github.rey5137:material:1.2.1'`, `'com.github.dexafree:materiallist:3.0.1'` and `'com.mikepenz:materialdrawer:3.1.2@aar'`. – Jared Burrows Jan 10 '16 at 23:33
  • thanks. removing multidexEnabled did bring some improvement. i also added this to my build.gradle. dexOptions { preDexLibraries = false } – div Jan 10 '16 at 23:48
  • `preDexLibraries` should only be `false` for CI builds. – Jared Burrows Jan 10 '16 at 23:50
  • can you please suggest some changes in this SO question?: http://stackoverflow.com/questions/34373032/apptransformclasseswithdexfordebug-taking-too-much-time – div Jan 10 '16 at 23:54

0 Answers0