为什么 FirebaseApp 初始化很慢,如何减少应用程序启动时间

Why FirebaseApp initialization is very slow,How to reduce app start time

我正在制作一个 android 应用程序,之前我使用 gcm 进行推送通知,现在我正在尝试使用 firebase 云消息传递来发送推送 notifications.I 已经在我的应用程序中实现了 firebase 云消息传递功能它工作正常但问题是应用程序第一次启动时花费了太多时间,请帮助我

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.next.fcm"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }

}

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

    compile 'com.google.firebase:firebase-messaging:9.0.0'

}
apply plugin: 'com.google.gms.google-services'

Do not compile whole fcm lib just compile below line.

compile "com.google.firebase:firebase-messaging:9.0.0"