V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Adia
V2EX  ›  问与答

有谁用过 ProGuard 吗?

  •  
  •   Adia · 2016-12-20 19:29:52 +08:00 · 908 次点击
    这是一个创建于 2699 天前的主题,其中的信息可能已经有所发展或是发生改变。

    项目是模块化的,我需要混淆其中一个模块,叫它 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 条回复    2016-12-20 22:40:46 +08:00
    SoloCompany
        1
    SoloCompany  
       2016-12-20 22:40:46 +08:00
    jar 里面的用 -injar
    jar 外面的用 -libjar
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1474 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:31 · PVG 01:31 · LAX 10:31 · JFK 13:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.