如何删除未使用从谷歌播放服务库中导入Google+的图标 [英] How to remove unused Google+ icons imported from Google Play Services library

查看:127
本文介绍了如何删除未使用从谷歌播放服务库中导入Google+的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经迁移的AdMobs横幅广告,谷歌播放服务在我的Andr​​oid Studio项目。由此产生的APK 0.7 MB雨后春笋般超过1.6 MB。幸运的是ProGuard的敲下来刚刚超过1 MB。我周围戳对APK和注意到280κB的G +的图像已被添加到

I've migrated the AdMobs banner ads to Google Play Services in my Android Studio project. The resulting APK mushroomed from 0.7 MB to over 1.6 MB. Fortunately ProGuard knocked it down to just over 1 MB. I poked around the APK and noticed that 280 kB of "g+" images have been added to

res/
 drawable-hdpi
 drawable-mdpi
 drawable-xhdpi
 drawable-xxhdpi

我不打算永远使用Google+在此应用程序。这是一个实用的应用程序,有没有需要处理的社会化媒体。 280KB听起来像是花生相比,多兆字节的应用程序,但作为一个比较简单实用,用户希望它尽可能小。我就觉得脏,释放出炸毁从〜700 KB到1000 KB没有具体的功能改进,为用户的新版本。

I have no plans to ever use Google+ in this app. It's a utility app and there's no need to deal with social media. 280kB may sound like peanuts compared to multi-Megabyte apps, but being a relatively simple utility, users want it to be as small as possible. It just feels dirty releasing a new version that blows up from ~700 kB to over 1000 kB with no tangible feature improvements for the user.

在理想情况下,我想排除这些图标只有一个项目,但我可以忍受一个全球性的解决方案了。

Ideally I'd like to exclude those icons for just one project, but I could live with a global solution for now.

推荐答案

目前为止最好的两个选项是微小的位图或别名添加到名为一样的G +图标的项目。这些取代在GPS库中的图标。图标是在每个drawable- *目录与以下文件名:

So far the two best options are to add tiny bitmaps or aliases to the project named the same as the g+ icons. These supersede the icons in the GPS library. The icons are in each of the drawable-* directories with the following filenames:

res/
 drawable-hdpi/
 drawable-mdpi/
 drawable-xhdpi/
 drawable-xxhdpi/
        common_signin_btn_icon_disabled_dark.9.png
        common_signin_btn_icon_disabled_focus_dark.9.png
        common_signin_btn_icon_disabled_focus_light.9.png
        common_signin_btn_icon_disabled_light.9.png
        common_signin_btn_icon_focus_dark.9.png
        common_signin_btn_icon_focus_light.9.png
        common_signin_btn_icon_normal_dark.9.png
        common_signin_btn_icon_normal_light.9.png
        common_signin_btn_icon_pressed_dark.9.png
        common_signin_btn_icon_pressed_light.9.png
        common_signin_btn_text_disabled_dark.9.png
        common_signin_btn_text_disabled_focus_dark.9.png
        common_signin_btn_text_disabled_focus_light.9.png
        common_signin_btn_text_disabled_light.9.png
        common_signin_btn_text_focus_dark.9.png
        common_signin_btn_text_focus_light.9.png
        common_signin_btn_text_normal_dark.9.png
        common_signin_btn_text_normal_light.9.png
        common_signin_btn_text_pressed_dark.9.png
        common_signin_btn_text_pressed_light.9.png
        ic_plusone_medium_off_client.png
        ic_plusone_small_off_client.png
        ic_plusone_standard_off_client.png
        ic_plusone_tall_off_client.png

我创建了一个微小的9补丁位图复制,并命名为每个在绘制迪尔斯这些文件。你可以几乎看不到在这里--->

I created a tiny 9-patch bitmap copied and named as each of those files in the drawable dirs. You can barely see it here --->

另一种方法是创建别名。每个文件一个位图别名,这样你最终的文件数相同。例如:

The alternative is to create aliases. One bitmap alias per file so you end up with the same number of files. For example:

res/
 drawable/
        blank.png
 drawable-xxhdpi/
        common_signin_btn_icon_disabled_dark.9.xml
        ...

每个别名XMLS的引用微小之一:

Each of the alias XMLs references the tiny one:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/blank" />

的大小差异是可忽略的微小位图和别名之间。是的,它是一个黑客,但直到谷歌/ ProGuard的自动删除未使用的位图,这可能是恢复浪费空间的唯一途径。感谢CommonsWare的协助。

The size difference is negligible between the tiny bitmap and the alias. Yes it's a hack, but until Google/ProGuard automatically removes unused bitmaps, this may be the only way to recover the wasted space. Thanks to CommonsWare for the assist.

这篇关于如何删除未使用从谷歌播放服务库中导入Google+的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆