tinker icon indicating copy to clipboard operation
tinker copied to clipboard

ignoreWarning is false, but resources.arsc is changed, you should use applyResourceMapping mode to build the new apk, otherwise, it may be crash at some times

Open 411370845 opened this issue 10 years ago • 18 comments

image 我只修改了BaseBuildInfo.TEST_MESSAGE的值,没改别的,但tinkerPatchDebug的时候报错了

411370845 avatar Sep 26 '16 09:09 411370845

resources.arsc改变,请先仔细查看文档与使用说明

shwenzhang avatar Sep 26 '16 09:09 shwenzhang

@411370845 你需要指定r.txt路径

dodola avatar Sep 26 '16 09:09 dodola

@dodola 知道了,tinkerPatchDebug成功了,谢谢两位大神

411370845 avatar Sep 26 '16 10:09 411370845

@shwenzhang 你好,看了你的这篇博客https://my.oschina.net/shwenzhang/blog/751618,你们是怎么做到补丁包10K的?按教程打补丁tinker-sample-android都要有166kb(仅仅打开一句log),差太多了吧?补丁包里面多了很多并没有改变过的图片,是因为你们微信res资源混淆过了吗?

kongnanlive avatar Sep 27 '16 02:09 kongnanlive

@kongnanlive ,你看看补丁包具体的内容,只改变一句log,补丁包是在4k以内的。

shwenzhang avatar Sep 27 '16 02:09 shwenzhang

如果使用了资源混淆需要保证两次混淆的时候使用同一份mapping,请根据教程配置

shwenzhang avatar Sep 27 '16 02:09 shwenzhang

@shwenzhang 没用mapping我是debug模式,日子发你看下。 log.txt

kongnanlive avatar Sep 27 '16 02:09 kongnanlive

日志你自己也可以看到,不是说的很清楚,找到很多新增的资源?你自己解压两个安装包就知道是否是真的新增了?

shwenzhang avatar Sep 27 '16 02:09 shwenzhang

@shwenzhang 问题是这些图片为什么会是新增的? add resource: res/drawable-xxxhdpi-v4/abc_btn_check_to_on_mtrl_000.png, oldSize=0, newSize=295 add resource: res/drawable-xxxhdpi-v4/abc_btn_check_to_on_mtrl_015.png, oldSize=0, newSize=551 add resource: res/drawable-xxxhdpi-v4/abc_btn_radio_to_on_mtrl_000.png, oldSize=0, newSize=1014 add resource: res/drawable-xxxhdpi-v4/abc_btn_radio_to_on_mtrl_015.png, oldSize=0, newSize=1226 add resource: res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, oldSize=0, newSize=3524 add resource: res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, oldSize=0, newSize=3853 add resource: res/drawable-xxxhdpi-v4/abc_ic_ab_back_mtrl_am_alpha.png, oldSize=0, newSize=240 add resource: res/drawable-xxxhdpi-v4/abc_ic_clear_mtrl_alpha.png, oldSize=0, newSize=566 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_copy_mtrl_am_alpha.png, oldSize=0, newSize=418 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_cut_mtrl_alpha.png, oldSize=0, newSize=1253 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_moreoverflow_mtrl_alpha.png, oldSize=0, newSize=378 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_paste_mtrl_am_alpha.png, oldSize=0, newSize=680 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_selectall_mtrl_alpha.png, oldSize=0, newSize=390 add resource: res/drawable-xxxhdpi-v4/abc_ic_menu_share_mtrl_alpha.png, oldSize=0, newSize=1559 add resource: res/drawable-xxxhdpi-v4/abc_ic_search_api_mtrl_alpha.png, oldSize=0, newSize=1571 add resource: res/drawable-xxxhdpi-v4/abc_ic_voice_search_api_mtrl_alpha.png, oldSize=0, newSize=1291 add resource: res/drawable-xxxhdpi-v4/abc_scrubber_control_to_pressed_mtrl_000.png, oldSize=0, newSize=666 add resource: res/drawable-xxxhdpi-v4/abc_scrubber_control_to_pressed_mtrl_005.png, oldSize=0, newSize=959 add resource: res/drawable-xxxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, oldSize=0, newSize=617 add resource: res/drawable-xxxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, oldSize=0, newSize=1025 add resource: res/drawable-xxxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, oldSize=0, newSize=208

这明明是support库里面自带的,gradle我又没改什么东西。

kongnanlive avatar Sep 27 '16 02:09 kongnanlive

你解压两个安装包,确认一下旧的apk是否真的没有这些资源?

shwenzhang avatar Sep 27 '16 02:09 shwenzhang

@shwenzhang 确实是新增的,原包1.3M新包1.5M,我服Android Studio,还好问过你,不然就误会tinker了。

kongnanlive avatar Sep 27 '16 02:09 kongnanlive

事实上,日志已经写的很清楚,不应该来问的。热补丁并不简单,还是建议多浏览一下大致框架代码

shwenzhang avatar Sep 27 '16 02:09 shwenzhang

@shwenzhang "不应该来问的"这句话不喜欢听,但我还是礼貌的把步骤重现下,设备三星Galaxy J3 Android 5.1.1多次运行都是1.3M,换台魅族M351 Android4.4.4 Flyme os 4.2.8.1A,任何代码不动编译运行后变成1.5M。谢谢的回答! image

kongnanlive avatar Sep 27 '16 03:09 kongnanlive

@kongnanlive ,并没有冒犯你的意思。如果让你觉得不舒服,这里我道歉。只是个人认为任何的提问都是建立在自己已经充分研究的基础上。对于为什么不同的target编译出来的包不一样大小,也是非常好理解的

shwenzhang avatar Sep 27 '16 03:09 shwenzhang

@kongnanlive 这个问题是因为assembleDebug和AndroidStudio直接运行生成出来的包不一致造成的。。。。

dodola avatar Sep 27 '16 09:09 dodola

这里确实不是tinker的问题,但是想问一下,为什么直接运行和执行assembleXXX运行出来的包是不一样的呢? @dodola

icespring avatar Oct 10 '16 00:10 icespring

@icespring shwenzhang 已经说过了“不同的target编译出来的包不一样大小”

kongnanlive avatar Oct 10 '16 02:10 kongnanlive

@icespring 怀疑是AndroidStudio针对你选择的Device进行了资源上的优化,但是这个没有找到相关资料说明,只是猜测

dodola avatar Oct 10 '16 07:10 dodola