android-support-v4删除未使用的类 [英] android-support-v4 remove unused classes

查看:274
本文介绍了android-support-v4删除未使用的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尤其是,我正在尝试将应用程序的.apk缩小到尽可能小的大小.我目前有导入的android-support-v4 jar文件.我的问题是:如何从此jar文件中删除未使用的类?

Bacially, I am trying to shrink my application's .apk down to the smallest size possible. I currently have android-support-v4 jar file imported. My question is this: how do I remove unused classes from this jar file?

经过大量搜索后未找到任何信息.如果使用ProGuard作为解决方案,将不胜感激包含在我的proguard-project.txt文件中的文本.

Not finding any information after quite a bit of searches. If ProGuard is the solution, text to include in my proguard-project.txt file would be appreciated.

推荐答案

ProGuard确实缩小了应用程序的大小.它将应用程序代码(src/...)和库代码(libs/...,库项目)视为相同,因此您无需更改项目的结构.如果您使用的是大型库的一小部分,则此功能特别有用,因为它会删除未使用的部分.

ProGuard indeed shrinks the size of applications. It treats application code (src/...) and library code (libs/..., library projects) the same, so you don't need to change the structure of your project. It is especially useful if you are using small parts of large libraries, since it removes the unused parts.

Android开发人员指南介绍了如何启用ProGuard的发行版.如果您的应用程序不执行任何反射操作,则默认配置(带有空的proguard-project.txt)应该就足够了.

The Android developer guide explains how you can enable ProGuard for release builds. If your application doesn't perform any reflection, the default configuration (with an empty proguard-project.txt) should be sufficient.

这篇关于android-support-v4删除未使用的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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