1

I have recently added FCM to my project and it's working fine. I have used

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

this line for the library since messaging service is only required. But when I have seen the external libraries dir there are many firebase classes which have no use in my app. Please see the image below.

a busy cat

Edited : Here is the whole dependency clause

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'
Community
  • 1
  • 1
android_griezmann
  • 3,757
  • 4
  • 16
  • 43

2 Answers2

2

You are including more libraries than you need because you are using the general play-services library and not using the split libraries like play-services-drive or some other specific library.

By using play-services:9.0.2 you are saying you want to include all libraries in Google Play services including all the Firebase ones.

Removing the play-services:9.0.2 dependency and replacing it with a specific one like play-services-drive:9.0.2 (depending on what APIs you want to use) should fix your issue.

Arthur Thompson
  • 9,087
  • 4
  • 29
  • 33
1

I believe since you don't add the core lib dependency explicity. The messaging dependency downloads all of the Firebase one.

Try adding the core and messaging both to limit the things to messaging part

compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'
Shubhank
  • 21,721
  • 8
  • 65
  • 83