【发布时间】:2017-09-11 09:38:48
【问题描述】:
我在我的项目中使用了一些有用的库,所有这些库都添加并安装在 Gradle 上,但是当我每次启动应用程序时,这个库会导致速度下降
在手机上安装 apk 后尝试启动延迟 3 秒的应用程序
this link as Android build gradle is too slow 不是我的问题
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${support_library}"
compile "com.android.support:support-v13:${support_library}"
compile "com.android.support:cardview-v7:${support_library}"
compile "com.android.support:recyclerview-v7:${support_library}"
compile "com.android.support:design:${support_library}"
compile 'org.greenrobot:eventbus:3.0.0'
compile('io.socket:socket.io-client:0.8.3') {
exclude group: 'org.json', module: 'json'
}
compile 'com.facebook.rebound:rebound:0.3.8'
compile 'com.tumblr:backboard:0.1.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${dbflow_version}"
compile "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.google.dagger:dagger:2.10'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
compile 'com.google.dagger:dagger-android:2.10'
compile 'com.google.dagger:dagger-android-support:2.10' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.10'
compile 'com.google.code.gson:gson:2.7'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.android.support:multidex:+'
}
gradle.properties 包含:
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
我该如何解决这个问题并加快应用程序的启动速度?
【问题讨论】:
-
我猜库不是问题。问题是即时运行功能。尝试取消选中即时运行功能,您的问题将解决。这对我有用。
-
在this page上尝试解决方案。
-
@AndyDeveloper
Enable Instant Run已禁用,我无法取消选中,放慢 Gradle 速度不是我的问题 -
@tux-world 我知道减慢 gradle 不是你的问题。我不是在谈论 gradle 我在谈论启动应用程序。当我使用即时运行时,我的应用程序需要太多时间来加载,它在启动画面之前还会显示黑屏或白屏。我在谷歌上搜索,所以我得到了我的项目的答案,即即时运行就是这样做的。所以我只是取消选中即时运行选项及其对我的工作。