Kanj Narayan Kanj Narayan - 1 year ago 344
Android Question

Remove firebase analytics from android app completely

I added firebase analytics in my app just to try it out. I followed the steps in official guidelines.

Now I have decided against it. I have undone whatever I had done to add it.
(Removed entries from project level and app level build.gradle; removed all usages from source code.)

But I am still getting logs like

I/FirebaseInitProvider: FirebaseApp initialization successful

when my app runs.

This leads me to believe that I haven't removed it completely. This is really a matter of concern for me now because my app has exceeded method count limit and I have had to enable multidex.

How can I completely remove firebase from my app?

Answer Source


configurations {
    all*.exclude group: 'com.google.firebase', module: 'firebase-core'
    all*.exclude group: 'com.google.firebase', module: 'firebase-iid'

removes all lines from app/app.iml containing firebase (and they do not get added automatically again) and removes all firebase libraries from generated code and intermediate output as well.

Compared to the previous answer this knocks off another 87,000 bytes from apk size.

Though I still do not understand why I should have to ADD more code to undo adding something. It's probably a bug in the build system.

@isnotmenow: Thanks a lot for pointing me in this direction.