我最近将FCM添加到我的项目中,并且工作正常。我用过

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


因为仅需要消息传递服务,所以此行用于库。但是,当我看到外部库目录时,有许多firebase类在我的应用中没有用。请参见下图。



编辑:这是整个依赖项

dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'


}

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

最佳答案

由于您使用的是常规播放服务库,而不使用诸如play-services-drive之类的拆分库或某些其他特定的库,因此包含的库超出了所需。

通过使用play-services:9.0.2,您是说要在Google Play服务中包括所有库,包括所有Firebase库。

删除play-services:9.0.2依赖项并替换为特定的依赖项,例如play-services-drive:9.0.2(取决于您要使用的API)即可解决您的问题。

10-07 19:39
查看更多