Adia
V2EX  ›  问与答

有谁用过 ProGuard 吗?

  •  
  •   Adia · Dec 20, 2016 · 1321 views
    This topic created in 3458 days ago, the information mentioned may be changed or developed.

    项目是模块化的,我需要混淆其中一个模块,叫它 A 模块吧。

    -injars old_jar_path
    -outjars new_jar_path
    #keep 表示符合条件的代码不会被混淆
    -keep public class * {
        public protected <fields>;
        public protected <methods>;
    }
    #
    -keepdirectories
    #不去忽略非公共的库类
    -dontskipnonpubliclibraryclasses
    #不去忽略包可见的库类的成员
    -dontskipnonpubliclibraryclassmembers
    #保证异常不被去除
    -keepattributes Exceptions
    
    

    然后我去运行命令的时候报了很多的 Warning :

    • can't find referenced class XXXX
    • 很显然,是和 A 模块平行的模块没有被找到..

    官网上似乎给了几种解决方案:

    • you should specify it with -injars, otherwise you should specify it with -libraryjars
    • 这似乎是用来指定 jar 的
    • you can try your luck with the -ignorewarnings option, or even the -dontwarn option.
    • 直接 error 了, fuck the luck..

    已经在 google 和 stackoverflow 逛了许久了...求 dalao 相助..TAT

    1 replies    2016-12-20 22:40:46 +08:00
    SoloCompany
        1
    SoloCompany  
       Dec 20, 2016
    jar 里面的用 -injar
    jar 外面的用 -libjar
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   979 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:21 · PVG 06:21 · LAX 15:21 · JFK 18:21
    ♥ Do have faith in what you're doing.