Atlas DexPatch调试记录

DexPatch简介

DexPatch是以动态部署技术方案为基础,以快速解决线上故障为唯一目的的动态化方案。

简单来说,动态部署是针对Apk级别的动态升级,DexPatch是针对Bundle级别的动态修复(主dex可以认为是一个Bundle)

打包DexPatch

基于ap所属的版本(1.0.0)

..\gradlew publish

修改Bundle版本

修改Bundle代码,并修改Bundle版本(也可以修改Bundle依赖的某个aar的版本)

group = 'com.atlas.demo'
version = '1.0.1'

指定基线版本,生成dexPatch包

..\gradlew clean assembleDebug -DapVersion=1.0.0 -DversionName=1.0.0

push 1.0.0@1.0.0.tpatch & dexpatch-1.0.0.json

adb push build\outputs\tpatch-debug\dexpatch-1.0.0.json /sdcard/Android/data/com.taobao.demo/cache/
adb push build\outputs\tpatch-debug\1.0.0@1.0.0.tpatch /sdcard/Android/data/com.taobao.demo/cache/

调试日志

firstbundle: 1.0.0 -> 1.0.1

I/yezhou: dexPatchUpdate begin
D/DexMergeClient: Get binder159 ms
D/DexMergeClient: dexMerge  true487 ms
D/update: merge: true com.taobao.firstbundle 1
D/update: install: true com.taobao.firstbundle 1
D/update: update success
I/yezhou: dexPatchUpdate end

firstbundle: 1.0.1 -> 1.0.2

I/yezhou: dexPatchUpdate begin
I/yezhou: isDexPatched
I/yezhou: version: 1
E/delete: /data/user/0/com.taobao.demo/files/storage/com.taobao.firstbundle/dexpatch/1
D/DexMergeClient: Get binder315 ms
D/DexMergeClient: dexMerge  true486 ms
D/update: merge: true com.taobao.firstbundle 2
D/update: install: true com.taobao.firstbundle 2
D/update: update success
I/yezhou: dexPatchUpdate end

secondbundle: 1.0.0 -> 1.0.1

I/yezhou: dexPatchUpdate begin
I/yezhou: isDexPatched
I/yezhou: version: 13
D/DexMergeClient: Get binder177 ms
D/DexMergeClient: dexMerge  true707 ms
D/update: merge: true com.taobao.secondbundle 3
D/update: merge: true com.taobao.firstbundle 3
D/update: install: true com.taobao.secondbundle 3
D/update: install: true com.taobao.firstbundle 3
D/update: update success
I/yezhou: dexPatchUpdate end

注:若dexPatchUpdate不成功,则重启APP进程重新dexPatchUpdate

dexpatch-1.0.0.json

{
    "baseVersion":"1.0.0",
    "diffBundleDex":true,
    "patches":[
        {
            "bundles":[
                {
                    "artifactId":"secondbundle",
                    "dependency":[

                    ],
                    "dexpatchVersion":"3",
                    "inherit":false,
                    "isMainDex":false,
                    "name":"com.taobao.secondbundle",
                    "newBundle":false,
                    "patchType":1,
                    "pkgName":"com.taobao.secondbundle",
                    "reset":false,
                    "srcUnitTag":"221s8s6hnw066",
                    "unitTag":"3l3h7art62o7a",
                    "version":"1.0.1"
                },
                {
                    "artifactId":"firstbundle",
                    "dependency":[
                        "com.taobao.publicBundle"
                    ],
                    "dexpatchVersion":"3",
                    "inherit":false,
                    "isMainDex":false,
                    "name":"com.taobao.firstbundle",
                    "newBundle":false,
                    "patchType":1,
                    "pkgName":"com.taobao.firstbundle",
                    "reset":false,
                    "srcUnitTag":"2ddkv55keedea",
                    "unitTag":"wso75w9m111a",
                    "version":"1.0.2"
                }
            ],
            "dexPatch":true,
            "fileName":"1.0.0@1.0.0.tpatch",
            "patchVersion":"1.0.0",
            "targetVersion":"1.0.0"
        }
    ]
}

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/18/atlas-dexpatch-debug/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
Atlas DexPatch调试记录
DexPatch简介 DexPatch是以动态部署技术方案为基础,以快速解决线上故障为唯一目的的动态化方案。 简单来说,动态部署是针对Apk级别的动态升级,DexPatch是针……
<<上一篇
下一篇>>
文章目录
关闭
目 录