构建应用的发行版时,是否应该保留android.support.v4.app.Fragment及其派生类? [英] Should I keep android.support.v4.app.Fragment and its derived classes when building a release version of my app?

查看:91
本文介绍了构建应用的发行版时,是否应该保留android.support.v4.app.Fragment及其派生类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了此答案,并解释了为什么我应该保留服务,活动和自定义视图的名称.但是我应该保留从android.support.v4.app.Fragment派生的类吗?

I read this answer and undestood why I should keep names of my services, activities, and custom views. But should I keep my classes which derive from android.support.v4.app.Fragment?

我还查看了默认的Proguard配置文件%SDK_DIR%\sdk\tools\proguard\proguard-android.txt,并且没有关于片段的规则.

I also took a look at the defualt Proguard config file %SDK_DIR%\sdk\tools\proguard\proguard-android.txt, and there were no rules regarding fragments.

推荐答案

需要保留class的主要原因是因为它是通过反射访问的.

The main reason why you would need to keep a class, is because it is accessed via reflection.

Fragments通常不通过反射访问,因此您不必保留它们.

Fragments are normally not accessed via reflection, so you don't have to keep them.

除了,如果您直接在布局文件中引用它们(因为解析布局文件使用反射).

Except if you reference them directly in layout files (because parsing layout files uses reflection).

这篇关于构建应用的发行版时,是否应该保留android.support.v4.app.Fragment及其派生类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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