问题描述
以下是首次安装应用程序时的日志:
Below is log when app is first time installing:
我正在使用我的项目中的MultiDex
库将完全在预棒棒糖设备以下运行。此延迟在Lollipop设备首次启动应用程序的30秒至90秒之间变化。
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.
看到不是由于 MultiDex
对吗?因为时间为1。)初始化 05-12 13:16:23.632 ,第二个日志在36秒后出现,这是 05-12 13:16:59.041
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
这会导致应用延迟 ClassLoader
引用...。 MultiDex
正在快速初始化。以下是屏幕截图这需要15到30秒,有时甚至还要更多。
That thing creates app delay ClassLoader
referenced.... MultiDex
is initializing fast. Below is the screen shot It is taking 15 seconds to 30 seconds and sometime even more.
我的Gradle文件是:
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'
}
任何帮助升值的东西。
推荐答案
16天多一点之后终于找到了答案,这一切都要感谢@Amir。正确的答案是禁用即时运行然后再运行。新发布的Android Studio 2.0及更高版本存在一个奇怪的问题。 2.1。第一次启动应用程序所需的时间比平时更长,此问题仅在调试模式下才会发生,并且不会影响您发布的APK。
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
这篇关于首次启动Android应用程序会花费更多时间,甚至30秒甚至更长的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!