Remove firebase analytics from android app completely
If you want to completely remove the firebase, you can achieve it by reversing the setup steps.
- Remove classpath 'com.google.gms:google-services:3.0.0' from your project gradle.
- Remove compile 'com.google.firebase:firebase-core:9.2.0' from your app build.gradle.
- Remove apply plugin: 'com.google.gms.google-services' from the bottom of your build.gradle.
- Remove FirebaseService code from your project.
- Remove google-services.json from your project.
- Remove google key from your Manifest.
- Remove google key from your resource value.
- Clean project.
- Build project.
- Remove installed app from test device, then install it again.
-- UPDATE --
From https://stackoverflow.com/a/37945280/4758255 :
I would suggest you to exclude the firebase group using gradle in app module build.gradle
, you can add this in dependency:
compile('com.google.android.gms:play-services-ads:9.0.2') {
exclude group: 'com.google.firebase', module: 'firebase-common'
}
compile('com.google.android.gms:play-services-gcm:9.0.2') {
exclude group: 'com.google.firebase', module: 'firebase-common'
}
Or, simply apply a global exclude configuration (Remember that this should be outside any groovy function), like this :
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-common'
}
Adding
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.