android - 集成Google Play服务分析库后减少应用程序的方法数量

标签 android google-analytics google-play-services android-multidex

我需要集成 Google Play Services Analytics 库,但它为我的应用程序贡献了 28k 个方法!我被迫使用 multidex,但为了保持应用程序的大小,我不希望使用 multidex。鉴于 Android 支持库贡献了 18k,仅仅为 Analytics 贡献 28k 有点疯狂,不是吗?还有其他方法可以减少此方法计数的膨胀吗?

以下是我放入 build.gradle 中的依赖项:

compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.+'
compile 'com.adjust.sdk:adjust-android:4.1.2'

我正在使用这些工具来计算方法计数: https://gist.github.com/JakeWharton/6002797

它向我显示 com.google 包正在贡献 28901 个方法。

最佳答案

如果不使用 multidex,您的另一个选择是删除您不与 Proguard 一起使用的部分库。

关于android - 集成Google Play服务分析库后减少应用程序的方法数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33551896/

相关文章:

android - play-services-ads 与 appcompat 冲突

android - 无法将 Google Play 定位服务作为依赖项添加到我的 Android 项目

android - 如何在电子表格中获取应用程序脚本的 ID

android - android studio 中的 proguard-rules.txt 在哪里?

android - onGlobalLayoutListener 与 postRunnable

Android:从历史堆栈中清除旧的 Activity 实例

javascript - Gatsbyjs + Google Analytics - 跟踪自定义事件?

javascript - 基于 AJAX 的网站上的新 'Universal' Google 分析脚本

android - java.lang.SecurityException "gps"位置提供者需要 ACCESS_FINE_LOCATION 权限

google-analytics - 使用 curl 和增强的电子商务跟踪购买服务器端