[英]Remove firebase analytics from android app completely
I added firebase analytics in my app just to try it out.我在我的应用程序中添加了 firebase 分析只是为了尝试一下。 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.)
(从项目级别和应用级别 build.gradle 中删除条目;从源代码中删除所有用法。)
But I am still getting logs like this when my app runs:但是当我的应用程序运行时,我仍然收到这样的日志:
I/FirebaseInitProvider: FirebaseApp initialization successful
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.
现在这对我来说确实是一个问题,因为我的应用程序已超出方法计数限制,我不得不启用 multidex。
How can I completely remove firebase from my app?如何从我的应用程序中完全删除 firebase?
If you want to completely remove the firebase, you can achieve it by reversing the setup steps.如果你想完全移除 firebase,你可以通过颠倒设置步骤来实现。
-- UPDATE -- -- 更新 --
From https://stackoverflow.com/a/37945280/4758255 :从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:我建议您在 app
module build.gradle
使用 gradle 排除 firebase 组,您可以将其添加为依赖项:
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.从 app/app.iml 中删除所有包含 firebase 的行(并且它们不会再次自动添加)并从生成的代码和中间输出中删除所有 firebase 库。
Compared to the previous answer this knocks off another 87,000 bytes from apk size.与之前的答案相比,这从 apk 大小中又减少了 87,000 个字节。
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. @isnotmenow:非常感谢您为我指出这个方向。
I had the same issue, i removed google_services.json
file.我遇到了同样的问题,我删除了
google_services.json
文件。 Removed firebase dependencies and most importantly in build.gradle (Project: GrowBuds) remove the following line删除了 firebase 依赖项,最重要的是在 build.gradle(项目:GrowBuds)中删除以下行
apply plugin: 'com.google.gms.google-services'
i was also facing this issue and after too much effort i have find a legal solution 1)Change the package name the method of changing the pacakage name 1) convert your studio from project level to android level 2)right click on android level and click on Compact middle pacakage 3)change the middle name of packge 4)again like 3rd step change the last name of package 5)change the package name in gradle file 2)go to firebasel console add project manullay add your new pacakge name add your sha1 key and continue 3)synchronise your project yahoo you have done \\我也面临这个问题,经过太多努力,我找到了一个合法的解决方案 1)更改包名称更改包名称的方法 1)将您的工作室从项目级别转换为 android 级别 2)右键单击 android 级别并单击在 Compact middle pacakage 3)更改包的中间名 4)再次像第 3 步一样更改包的姓氏 5)更改 gradle 文件中的包名称 2)转到 firebasel 控制台添加项目 manullay 添加您的新包名称 添加您的 sha1键并继续 3)同步你已经完成的项目 yahoo \\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.