How to obfuscate only few class or a single package?

我们两清 提交于 2019-12-09 15:55:46

问题


I would not obfuscate all my project but just the mostly key class. how to write the proguard file to exclude all project and obfuscate only a single class or a single package ?


回答1:


Please read the answer before downvote. You need ! before your class.

Take a look at Proguard Manual: Keep option part and Android example .

Example :

 -keeppackagenames com.vtcmobile {
    ! com.yourpackage.CategoryParser // keep package com.vtcmobile excluded class com.vtcmobile.CategoryParser
    }

Edit: Use

-keeppackagenames [package_filter] Specifies not to obfuscate the given package names. The optional filter is a comma-separated list of package names. Package names can contain ?, *, and ** wildcards, and they can be preceded by the ! negator. Only applicable when obfuscating.



来源:https://stackoverflow.com/questions/11896618/how-to-obfuscate-only-few-class-or-a-single-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!