Atlas DexPatch调试记录

DexPatch简介

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

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

打包DexPatch

基于ap所属的版本(1.0.0)

1
..\gradlew publish

修改Bundle版本

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

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

指定基线版本,生成dexPatch包

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

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

1
2
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

1
2
3
4
5
6
7
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

1
2
3
4
5
6
7
8
9
10
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

1
2
3
4
5
6
7
8
9
10
11
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
"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"
}
]
}

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :