简体   繁体   English

从 Android 应用程序中完全删除 Firebase 分析

[英]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,你可以通过颠倒设置步骤来实现。

  1. Remove classpath 'com.google.gms:google-services:3.0.0' from your project gradle.从您的项目 gradle 中删除类路径 'com.google.gms:google-services:3.0.0'
  2. Remove compile 'com.google.firebase:firebase-core:9.2.0' from your app build.gradle.从您的应用 build.gradle 中删除compile 'com.google.firebase:firebase-core:9.2.0'
  3. Remove apply plugin: 'com.google.gms.google-services' from the bottom of your build.gradle.从 build.gradle 的底部删除apply plugin: 'com.google.gms.google-services'
  4. Remove FirebaseService code from your project.从您的项目中删除FirebaseService代码。
  5. Remove google-services.json from your project.从您的项目中删除 google-services.json。
  6. Remove google key from your Manifest.从您的清单中删除谷歌密钥。
  7. Remove google key from your resource value.从您的资源值中删除 google 密钥。
  8. Clean project.清洁项目。
  9. Build project.构建项目。
  10. Remove installed app from test device, then install it again.从测试设备中删除已安装的应用程序,然后重新安装。

-- 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 \\

  • List item列表项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何完全断开 Android 应用与 Firebase 的连接(在 Android Studio 中) - How to completely disconnect an Android app from Firebase (in Android studio) 如何从子模块android中删除firebase分析? - How to remove firebase analytics from sub module android? 在Android应用中添加Firebase Analytics和Google Analytics - Adding Firebase Analytics and Google Analytics in Android App 如何从内存中彻底杀死并删除Android Phonegap应用 - How to completely kill and remove an android phonegap app from memory Firebase Analytics + Android应用程序(不在市场中) - Firebase Analytics + Android app (not in market) 是否可以通过在“ app_remove”事件中使用Google Analytics for Firebase触发器向Android应用自动发送推送通知 - Is it possible to send automatically push notification to android app by using Google Analytics for Firebase Triggers on “app_remove” event 完全退出安卓应用 - Exit completely from android app Android 应用程序无法连接到 Firebase 分析 - Android app does not connect to firebase analytics firebase Analytics:Android应用卸载统计信息 - firebase Analytics : Android app uninstall stats 将Google Analytics添加到没有Firebase的Android应用中 - Add Google Analytics to Android app without Firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM