How to obfuscate only few class or a single packag

2019-04-06 20:13发布

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条回答
老娘就宠你
2楼-- · 2019-04-06 20:30

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.

查看更多
登录 后发表回答