0

i'm using some useful library in my project, all of them added and installed on Gradle, but this libraries cause of speeding down when i'm launching application in each first time

after installing apk on phone and try to launch application that have 3 second delay

this link as Android build gradle is too slow is not my problem

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 contain:

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

how can i resolve this problem and speeding up launching application?

Community
  • 1
  • 1
tux-world
  • 2,680
  • 6
  • 24
  • 55
  • I guess library is not the problem.The problem is instant run feature.Try to uncheck instant run feature and your issue will resolve.This works for me. – Andy Developer Apr 15 '17 at 07:01
  • try solution on [this page](http://stackoverflow.com/questions/36529301/android-build-gradle-is-too-slow-dependency-resolution). – Mehran Zamani Apr 15 '17 at 07:03
  • @AndyDeveloper `Enable Instant Run` is disable and i can't uncheck that and slowing Gradle is not my problem – tux-world Apr 16 '17 at 05:30
  • @tux-world I know slowing gradle is not your problem.I am not talking about the gradle I am talking about launching app.When I use instant run my app takes too much time to load,it also shows black screen or white screen before splash screen.I search on google so I got the answer for my project that instant run is do that.So I just uncheck instant run option and its work for me. – Andy Developer Apr 17 '17 at 05:47

3 Answers3

0

First thing I would do is upgrade both Gradle and the Android Build Tools version to get the latest enhancements. (Gradle is 3.5 at the time of writing).

As far as libraries, your biggest killer for speed is

compile 'com.google.android.gms:play-services:10.2.1'

Do not compile all the play services. https://developers.google.com/android/guides/setup#split

EventBus may also be unnecessary if you implement RxJava a certain way.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

If i am not wrong this gives white screen stuck for a while , if that so it may be because of instant run , it wont affect on your release version give a shot and try this . If you still want to run fast first time while developing your app you can disable instant run follow this:

To disable Instant Run:

Open the Settings or Preferences dialog.
Navigate to Build,
Execution,
Deployment > Instant Run. Uncheck the box next to Enable Instant Run.

Reference : Google developer page

Amit Sharma
  • 645
  • 5
  • 13
0

I guess library is not the problem.The problem is with instant run feature. When I use instant run my app takes too much time to load,it also shows black screen or white screen according to my theme before splash screen.So, I guess the same issue you are facing.Try to unchecked instant run feature.

Preferences → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run.

If you not find these feature try to update your android studio with latest stable version.

If you still have an issue try to update your Android Plugin to newest alpha version and you can enable or disable instant run.

If you want to see which android plugin version you are running then goto

Open module setting → Project Structure window select Project → See Android plugin version

Andy Developer
  • 3,071
  • 1
  • 19
  • 39