Open fishlovestoeatcat opened 8 years ago
@fishlovestoeatcat 只有坚果手机这样么? gradle换成1.5.0试试
@fishlovestoeatcat 或者把你的分包配置信息和错误日志发来看看
-just activity asia.bluepay.best.pay.MainActivity
-keep asia.bluepay.best.pay.data. -keep asia.bluepay.best.pay.exceptions. -keep asia.bluepay.best.pay.helper. -keep asia.bluepay.best.pay.http. -keep asia.bluepay.best.pay.pay. -keep asia.bluepay.best.pay.utils. -keep asia.bluepay.best.pay.utils. -keep com.dodola.rocoofix. -keep com.dodola.rocoo.**
-keep asia.bluepay.best.pay.MainActivity.class -keep asia.bluepay.best.pay.MainActivity$1.class -keep asia.bluepay.best.pay.MainActivity$2.class -keep asia.bluepay.best.pay.MainActivity$3.class -keep asia.bluepay.best.pay.MainActivity$4.class -keep asia.bluepay.best.pay.MainActivity$5.class -keep asia.bluepay.best.pay.MainActivity$6.class -keep asia.bluepay.best.pay.MainActivity$7.class -keep asia.bluepay.best.pay.MainActivity$8.class -keep asia.bluepay.best.pay.MainActivity$9.class -keep asia.bluepay.best.pay.MainActivity$10.class -keep asia.bluepay.best.pay.MainActivity$11.class -keep asia.bluepay.best.pay.MainActivity$12.class -keep asia.bluepay.best.pay.MainActivity$13.class -keep asia.bluepay.best.pay.MainActivity$14.class -keep asia.bluepay.best.pay.MainActivity$15.class -keep asia.bluepay.best.pay.MainActivity$16.class -keep asia.bluepay.best.pay.MainActivity$17.class -keep asia.bluepay.best.pay.MainActivity$18.class -keep asia.bluepay.best.pay.MainActivity$19.class -keep asia.bluepay.best.pay.MainActivity$20.class -keep asia.bluepay.best.pay.MainActivity$21.class -keep asia.bluepay.best.pay.MainActivity$22.class -keep asia.bluepay.best.pay.MainActivity$23.class -keep asia.bluepay.best.pay.MainActivity$24.class -keep asia.bluepay.best.pay.MainActivity$25.class -keep asia.bluepay.best.pay.MainActivity$26.class -keep asia.bluepay.best.pay.MainActivity$27.class -keep asia.bluepay.best.pay.MainActivity$28.class -keep asia.bluepay.best.pay.MainActivity$29.class -keep asia.bluepay.best.pay.MainActivity$30.class -keep asia.bluepay.best.pay.MainActivity$31.class -keep asia.bluepay.best.pay.MainActivity$PayCallback$1.class -keep asia.bluepay.best.pay.MainActivity$PayCallback.class
-split asia.bluepay.best.pay.core.**
-split .
-donot-use-suggest
-log-mainlist
哈哈,我只好这样写了,上面那个保留activity的没用,这样写就可以用了
@fishlovestoeatcat 配置有误, -donot-use-suggest 注释掉 #-donot-use-suggest 这条的意思是不使用-just activity 动态生成的依赖树,注释掉表示使用
@fishlovestoeatcat keep的单独类可以去掉了,keep一般只在特殊情况下使用,这样可以保证main dex最小
我注释后MainActivity可以找到了,可是我里面的OnClickListener和内部类还是找不到
@fishlovestoeatcat 报什么错
09-01 17:00:30.898 32227-32227/? E/dalvikvm: Could not find class 'asia.bluepay.best.pay.ac', referenced from method asia.bluepay.best.pay.MainActivity.
哈哈。好长,就是找不到各种listener和内部类ac,被混淆了看不见名字
@fishlovestoeatcat 你用反射了么?用了的话需要把被反射的类keep
用到反射的类全部保留了包路径了
按照我最上面那种配置是可以正常使用的,就是有点别扭,加一大堆class
@fishlovestoeatcat 所以尽量在启动时不要做复杂逻辑,复杂逻辑可以延迟加载,程序业务上如果能优化就稍微优化下
我试了另外两个手机,你那种配置是可以的,但是那个坚果手机不行,没有把activity的内部类打进dex包里。另外请教一下,如果把项目打包成jar包,这种方式可以生效么?
@fishlovestoeatcat 可以生效
我已经写了-just activity asia.bluepay.best.pay.MainActivity,关闭了instant run,gradle版本是2.1.0,在坚果1上测试MainActivity没有打进主dex包中,如果单保留MainActivity.class,MainActivity中的内部类找不到