title: Android takes more time on application start up during first time launch
body: <p>In my project, I have used libraries which require multidex support. Based on the research I did, I came to know that it causes delay during app start up.</p>
  
  <p>I have enabled multidex feature in gradle. defaultConfig { multiDexEnabled true }</p>
  
  <p>I used to get NoClassDefFound Exception for kitkat devices so I added the following:</p>
  
  <p>I have added application name in manifest as 
     android:name="android.support.multidex.MultiDexApplication" </p>
  
  <p>and extended my application class with MultiDexApplication.</p>
  
  <p>I know any one of the above is sufficient but I have just written both.</p>
  
  <p>I tried different ways to optimize the duration of start up like the following :</p>
  
  <p>1.added  productFlavors {
        dev {
              minSdkVersion 21
            }
          prod {
              minSdkVersion 14
          }
      }</p>
  
  <ol start="2">
  <li><p>dexOptions {
  preDexLibraries false
  javaMaxHeapSize "4g"
  }</p></li>
  <li><p>I imported only required google play service's libraries instead of importing full library.</p></li>
  </ol>
  
  <p>Can you please suggest me an approach to improvise the duration because its actually taking more than 10 seconds and some times even more than that in some of the devices?</p>
  
  <p>Or Is there any other reason that might be causing the delay apart from multidex?</p>
  
  <p>Thanks in advance.</p>
  
  <p>I have added my build.gradle file contents : </p>
  
  <pre><code> apply plugin: 'com.android.application'
   apply plugin: 'com.google.gms.google-services'
  
   android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'
  
   defaultConfig {
      applicationId "com.example.app"
      minSdkVersion 17
      targetSdkVersion 23
      versionCode 3
      versionName "1.2"
      multiDexEnabled true
  }
  
  dexOptions {
      incremental true
      javaMaxHeapSize "10g"
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
    }
  }
  
    dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile files('libs/ormlite-android-4.28.jar')
      compile files('libs/ormlite-core-4.28.jar')
      compile project(':volley')
      compile 'com.android.support:cardview-v7:23.2.1'
      compile 'com.android.support:appcompat-v7:23.1.0'
      compile 'com.google.code.gson:gson:2.3.1'
      compile 'com.squareup.picasso:picasso:2.5.2'
      compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
      compile 'com.viewpagerindicator:library:2.4.1@aar'
      compile 'com.android.support:design:23.2.1'
      compile 'com.facebook.android:facebook-android-sdk:4.1.2'
      compile 'org.jsoup:jsoup:1.8.2'
      compile 'org.twitter4j:twitter4j:4.0.3'
      compile 'com.github.castorflex.smoothprogressbar:library-circular:1.1.0'
      compile 'com.orhanobut:dialogplus:1.11@aar'
      compile 'com.google.android.gms:play-services-maps:8.3.0'
      compile 'co m.google.android.gms:play-services-gcm:8.3.0'
      compile 'com.google.android.gms:play-services-location:8.3.0'
      compile 'org.java-websocket:Java-WebSocket:1.3.0'
      compile 'org.apache.commons:commons-lang3:3.4'
      compile 'com.android.support:multidex:1.0.1'
      compile 'com.android.support:recyclerview-v7:23.1.1'
   }
  </code></pre>