Tencent / tinker

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.
Other
17.1k stars 3.33k forks source link

多渠道打包,不同渠道分别有差异库,是否能实现公共代码热更? #1598

Open h634462445 opened 2 years ago

h634462445 commented 2 years ago

Issue/提问须知

在提交issue之前,我们应该先查询是否已经有相关的issue以及常见问题。提交issue时,我们需要写明issue的原因,以及编译或运行过程的日志(加载进程以及Patch进程)。issue需要以下面的格式:


异常类型:

手机型号:

### ### 手机系统版本:

tinker版本:1.9.14.17

gradle版本:3.5.1

是否使用热更新SDK:

系统:window

堆栈/日志:

2021-08-30 20:13:27.053 1124-8573/? D/CompatibilityChangeReporter: Compat change id reported: 149924527; UID 10362; state: ENABLED
2021-08-30 20:13:27.055 1124-8573/? D/CompatibilityChangeReporter: Compat change id reported: 132649864; UID 10362; state: DISABLED
2021-08-30 20:13:27.060 1679-1679/? V/Tinker.SamplePatchListener: receive a patch file: /storage/emulated/0/app-debug-patch_signed_7zip.apk, file size:4708
2021-08-30 20:13:27.065 1679-1679/? W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.wf.sdk.demo/tinker/patch.info: open failed: ENOENT (No such file or directory)
2021-08-30 20:13:27.065 1679-1679/? W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.wf.sdk.demo/tinker/patch.info: open failed: ENOENT (No such file or directory)
2021-08-30 20:13:27.065 1679-1679/? W/Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return

问题:我们有一套公共库,取名libA,此库需要不同渠道使用。不同渠道有另外不同的代码,即不同基包的dex是不同的。我希望达到只更新libA的效果。比如
只修改libA。其他都没变。然后使用"渠道1"作为基准包来制作补丁。此补丁更新到其他渠道。
自测效果:此补丁能 给"渠道1" 正常安装使用。但是其他渠道无法正常安装补丁。
查看已经有的issues,比如:https://github.com/Tencent/tinker/issues/12  解释说基包dex要完全一样。想问我不同渠道dex是不完全一样的,有没方案实现我描述的想要的效果?
业务场景:对于游戏app,因为不同渠道有对应不同SDK。所以不同渠道出的包dex肯定不一样。但是我们所有的渠道有一套共用框架代码。我们如果想要实现更新框架代码。就会有这种需求。(参考美团的roburt框架可以达到类似效果,但是它只修复代码,无法修复res)
参考技术(非开源):阿里Sophix,他能做到“支持多渠道包仅选用某个渠道包的补丁,只需要保证变化相同即可”
参考技术连接:https://help.aliyun.com/document_detail/53247.html?spm=5176.21213303.J_6028563670.7.a8a03eda5oWTwh&scm=20140722.S_help%40%40%E6%96%87%E6%A1%A3%40%4053247._.ID_53247-RL_%E5%A4%9A%E6%B8%A0%E9%81%93-OR_helpmain-V_1-P0_0