-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
找不到MainActivity #9
Comments
@fishlovestoeatcat 只有坚果手机这样么? gradle换成1.5.0试试 |
@fishlovestoeatcat 或者把你的分包配置信息和错误日志发来看看 |
#-----------主Dex中必要依赖的脚本配置----------- #-----------附加类----------- 如果你想要某个包路径在maindex中,则使用 -keep 选项,即使他已经在分包的路径中.若为空,不保留任意类-keep asia.bluepay.best.pay.data.** 保留单个类.-keep asia.bluepay.best.pay.MainActivity.class 这条配置可以指定这个包下类在第二及其他dex中.-split asia.bluepay.best.pay.core.** 不包含Android gradle 插件自动生成的miandex列表.(不用系统自带分包策略)-donot-use-suggest 不进行dex分包, 直到 dex 的id数量超过 65536.(设置自动执行分包策略)#-auto-maindex 显示miandex的日志.-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中的内部类找不到
The text was updated successfully, but these errors were encountered: