10

Below is log when app is first time installing:

05-12 13:16:23.632 28250-28250/com.app.projectName W/System: ClassLoader referenced unknown path: /data/app/com.app.projectName-1/lib/arm 05-12 13:16:59.041 28250-28250/com.app.projectName W/System: ClassLoader referenced unknown path: /data/app/com.app.projectName-1/lib/arm 05-12 13:16:59.073 28250-28250/com.app.projectName I/MultiDex: VM with version 2.1.0 has multidex support 05-12 13:16:59.073 28250-28250/com.app.projectName I/MultiDex: install 05-12 13:16:59.073 28250-28250/com.app.projectName I/MultiDex: VM has multidex support, MultiDex support library is disabled.

And I am using MultiDex library in my project it will work completely below pre lollipop devices.This delay varying in Lollipop devices between 30 sec to 90 sec first time app start up.

See it is not due to MultiDex right? because when time is 1.) initializing 05-12 13:16:23.632 and second log comes after 36 second which is 05-12 13:16:59.041

That thing creates app delay ClassLoader referenced.... MultiDex is initializing fast. Below is the screen shot enter image description here It is taking 15 seconds to 30 seconds and sometime even more.

My Gradle file is:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'

compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
compile 'org.apache.httpcomponents:httpcore:4.2.4'
compile 'org.apache.httpcomponents:httpmime:4.3'
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:logging-interceptor:3.1.2'
compile 'co.lujun:androidtagview:1.0.2'

compile 'com.google.android.gms:play-services-analytics:9.0.1'
compile 'com.google.android.gms:play-services-auth:9.0.1'
compile 'com.google.android.gms:play-services-plus:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1'
compile 'com.google.android.gms:play-services-maps:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
compile 'org.solovyev.android.views:linear-layout-manager:0.5@aar'
compile 'org.apache.commons:commons-lang3:3.0'

compile 'jp.wasabeef:picasso-transformations:2.0.0'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.greysonparrelli.permiso:permiso:0.2.0'
compile 'com.github.lawloretienne:imagegallery:0.0.14'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
compile 'com.github.mahmed8003:DroidValidatorLight:1.0.0'
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.yalantis:ucrop:1.1.+'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
}

Any help appreciate.

Aleksandar G
  • 1,163
  • 2
  • 20
  • 25
Anant Shah
  • 3,744
  • 1
  • 35
  • 48
  • 1
    http://stackoverflow.com/questions/33326575/vm-has-multidex-support-multidex-support-library-is-disabled/33327028 – IntelliJ Amiya May 12 '16 at 07:54
  • 1
    already saw this link and there is no delay for multidex due to some other some ClassLoader creates delay see log inside timings. 05-12 13:16:23.632 second line is 05-12 13:16:59.041 and in lollipop devices multidex will not work [link](http://developer.android.com/tools/building/multidex.html) @IntelliJ Amiya – Anant Shah May 12 '16 at 08:25
  • http://stackoverflow.com/questions/37459692/application-or-activity-takes-time-to-load-some-times/37460527#37460527 – Amir May 28 '16 at 10:57
  • disable instant run and this issue will be fixed. Also seeing this thread may be helpful http://stackoverflow.com/questions/36623917/first-launch-take-long-time-in-android-studio-2-0-gradle-2-0 – Amir May 28 '16 at 11:00
  • 1
    ok thank you for prompt reply @Amir – Anant Shah May 28 '16 at 11:01

2 Answers2

18

Finally found answer after more then 16 days all thanks to you @Amir. Correct answer is to disabling instant run then run. There is a strange issue with newly released Android Studio 2.0 & 2.1. first time of launching application take longer than usual this issue happens only in debug mode and not effect your released APK.

Settings/Preferences(Mac) → Build, Execution, Deployment → Instant Run and uncheck Instant Run
Anant Shah
  • 3,744
  • 1
  • 35
  • 48
4

Settings/Preferences(Mac) → Build, Execution, Deployment → Instant Run and uncheck Instant Run

enter image description here

I was also facing the same problem and finally i fixed this.
note:
1) before generating an apk file unchecked all these option to resolve delay issue from your production build.

2) while you are developing or adding new features then keep it as default setting(instant run) to make development faster.

I hope this will resolve your issue.

Abdul Rizwan
  • 3,904
  • 32
  • 31