Android Gradle Migration to gradle 3.0 having java.lang.OutOfMemoryError:

Hi,

My Android Project was working fine while i was using the older android gradle version which is gradle 2.0. I try to convert this to android gradle 3.0 and having java out of memory
exception.
I have already increase my memory in gradle properties

    org.gradle.daemon=true
    org.gradle.jvmargs=-Xmx2048M -XX\:MaxHeapSize\=32g
    org.gradle.parallel=true
    org.gradle.configureondemand=true
    org.gradle.caching=true

And this is my gradle dependencies
this is my project dependencies
> dependencies {

    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
    implementation project(':common-ui')
    implementation project(':util')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation "com.android.support:appcompat-v7:$versions.appcompat"
    implementation "com.android.support:support-annotations:$versions.appcompat"
    implementation "com.android.support:design:$versions.appcompat"
    implementation "com.android.support:support-v4:$versions.appcompat"
    implementation "com.android.support:percent:$versions.appcompat"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.8.0'
    annotationProcessor 'com.google.guava:guava:22.0'
    implementation 'com.google.dagger:dagger:2.11'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
   // implementation 'javax.inject:javax.inject:1'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
    implementation 'com.trello:rxlifecycle:0.4.0'
    implementation 'com.trello:rxlifecycle-components:0.4.0'
    implementation 'javax.annotation:javax.annotation-api:1.2'
    compileOnly 'com.google.auto.value:auto-value:1.5.1'
    annotationProcessor 'com.google.auto.value:auto-value:1.5.1'
    annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.6'
    provided 'com.jakewharton.auto.value:auto-value-annotations:1.5'

    implementation 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.squareup.okhttp3:okhttp:3.9.0'
    implementation "com.android.support:cardview-v7:$versions.appcompat"
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.1.0'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    //  debugImplementation project(path: ':common-ui');
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    // debugImplementation project(path: ':util');
    implementation 'de.jkeylockmanager:jkeylockmanager:1.1.0'
    implementation "com.google.android.gms:play-services-analytics:$versions.googlePlay"
    implementation "com.google.android.gms:play-services-location:$versions.googlePlay"
    implementation 'com.jakewharton.timber:timber:4.3.1'
    implementation 'com.facebook.android:facebook-android-sdk:4.11.0'
    implementation "com.android.support:preference-v7:$versions.appcompat"
    debugImplementation 'com.android.support:multidex:1.0.2'
    implementation 'com.evernote:android-job:1.1.0'
    implementation "com.google.firebase:firebase-messaging:$versions.googlePlay"
    implementation "com.google.firebase:firebase-core:$versions.googlePlay"
    implementation 'net.zetetic:android-database-sqlcipher:3.5.4'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.assertj:assertj-core:3.5.2'
    testImplementation 'org.hamcrest:hamcrest-all:1.3'
    testImplementation 'org.mockito:mockito-all:1.10.19'
    testImplementation 'org.json:org.json:2.0'
    implementation 'com.appsflyer:af-android-sdk:4+@aar'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
}

apply plugin: 'com.google.gms.google-services'

gradle build scan