Tencent / tinker

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

用360加固后,patch合成不成功,不加固没问题 #1306

Closed hsjjs126 closed 4 years ago

hsjjs126 commented 4 years ago

异常类型:项目(包括仓库中最新的sample)用360加固后,patch合成不成功;不加固没问题。TinkerPatch和直接集成Tinker都存在这样的问题。

手机型号:Lenovo TB-X605F,一加6

手机系统版本:Android 8.1.0,Android 9.0

tinker版本:1.9.14.3, 1.9.14.5

gradle版本:5.1.1

是否使用热更新SDK: TinkerPatch和直接用Tinker集成都使用过

系统:android

堆栈/日志: 2019-12-16 14:51:55.258 10572-10572/? D/Tinker.TinkerLoader: tryLoad test test 2019-12-16 14:51:55.263 10572-10572/? W/Tinker.TinkerLoader: tryLoadPatchFiles: we don't load patch with :patch process itself, just return 2019-12-16 14:51:55.266 10572-10572/? D/Tinker.DefaultAppLike: onBaseContextAttached: 2019-12-16 14:51:55.268 10572-10572/? I/MultiDex: VM with version 2.1.0 has multidex support 2019-12-16 14:51:55.268 10572-10572/? I/MultiDex: Installing application 2019-12-16 14:51:55.268 10572-10572/? I/MultiDex: VM has multidex support, MultiDex support library is disabled. 2019-12-16 14:51:55.285 10572-10572/? I/Tinker.SamplePatchListener: application maxMemory:192 2019-12-16 14:51:55.288 10572-10572/? W/Tinker.Tinker: tinker patch directory: /data/user/0/tinker.sample.android/tinker 2019-12-16 14:51:55.292 10572-10572/? I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.14.5 2019-12-16 14:51:55.293 10572-10572/? I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-1, process name:tinker.sample.android:patch, main process:false, systemOTA:false, fingerPrint:Lenovo/LenovoTB-X605F/X605F:8.1.0/OPM1.171019.019/S000017_181019_PRC:user/release-keys, oatDir:null, useInterpretMode:false 2019-12-16 14:51:55.294 10572-10572/? W/Tinker.TinkerLoadResult: tinker is disable, just return 2019-12-16 14:51:55.294 10572-10572/? I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/tinker.sample.android/tinker, code: -1, cost: 5ms 2019-12-16 14:51:55.295 10572-10572/? W/Tinker.Tinker: tinker load fail! 2019-12-16 14:51:55.296 10572-10572/? D/Tinker.DefaultAppLike: onCreate 2019-12-16 14:51:55.297 10572-10572/? D/Tinker.DefaultAppLike: onTrimMemory level:5 2019-12-16 14:51:55.298 10572-10572/? D/Tinker.DefaultAppLike: onTrimMemory level:5 2019-12-16 14:51:55.302 10572-10590/? I/Tinker.TinkerPatchService: for system version >= Android O, we just ignore increasingPriority job to avoid crash or toasts. 2019-12-16 14:51:55.302 10572-10590/? I/Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start 2019-12-16 14:51:55.302 10572-10572/? W/Tinker.UpgradePatchRetry: onPatchRetryLoad retry is not main process, just return 2019-12-16 14:51:55.304 10572-10590/? W/Tinker.UpgradePatchRetry: try copy file: /storage/emulated/0/patch_signed_7zip.apk to /data/user/0/tinker.sample.android/tinker_temp/temp.apk 2019-12-16 14:51:55.348 10572-10590/? I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:b088f23d3e68f102cbde7ab96c766b03 2019-12-16 14:51:55.351 10572-10590/? W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/tinker.sample.android/tinker/patch.info (No such file or directory) 2019-12-16 14:51:55.352 10572-10590/? W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/tinker.sample.android/tinker/patch.info (No such file or directory) 2019-12-16 14:51:55.352 10572-10590/? I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/user/0/tinker.sample.android/tinker/patch-b088f23d 2019-12-16 14:51:55.353 10572-10590/? W/Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /storage/emulated/0/patch_signed_7zip.apk size: 6085, dest file: /data/user/0/tinker.sample.android/tinker/patch-b088f23d/patch-b088f23d.apk size:6085 2019-12-16 14:51:55.363 10572-10590/? I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/classes.dex.jar 2019-12-16 14:51:55.366 10572-10590/? I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true 2019-12-16 14:51:55.366 10572-10590/? I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/test.dex.jar 2019-12-16 14:51:55.369 10572-10590/? I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true 2019-12-16 14:51:55.375 10572-10590/? I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/classes.dex.jar 2019-12-16 14:51:55.375 10572-10590/? I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/test.dex.jar 2019-12-16 14:51:55.375 10572-10590/? I/Tinker.DexDiffPatchInternal: merge classN dex file /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/tinker_classN.apk, result: true, size: 6597, use: 6ms 2019-12-16 14:51:55.376 10572-10590/? I/Tinker.DexDiffPatchInternal: legal files to do dexopt: [/data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/tinker_classN.apk] 2019-12-16 14:51:55.377 10572-10590/? D/Tinker.TinkerInternals: getCurrentInstructionSet:arm64 2019-12-16 14:51:55.378 10572-10590/? I/Tinker.DexDiffPatchInternal: patch recover, try to optimize dex file count:1, optimizeDexDirectory:/data/user/0/tinker.sample.android/tinker/patch-b088f23d/odex/ 2019-12-16 14:51:55.381 10572-10590/? I/Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/tinker_classN.apk, size: 6597 2019-12-16 14:51:55.381 10572-10590/? W/zygote64: Opening an oat file without a class loader. Are you using the deprecated DexFile APIs? 2019-12-16 14:51:55.436 10593-10593/? I/dex2oat: The ClassLoaderContext is a special shared library. 2019-12-16 14:51:55.436 10593-10593/? I/dex2oat: /system/bin/dex2oat --dex-file=/data/data/tinker.sample.android/tinker/patch-b088f23d/dex/tinker_classN.apk --output-vdex-fd=40 --oat-fd=41 --oat-location=/data/data/tinker.sample.android/tinker/patch-b088f23d/dex/oat/arm64/tinker_classN.odex --compiler-filter=quicken --class-loader-context=& 2019-12-16 14:51:55.588 10593-10593/? I/dex2oat: Explicit concurrent copying GC freed 9(15KB) AllocSpace objects, 0(0B) LOS objects, 99% free, 832B/1536KB, paused 155us total 7.719ms 2019-12-16 14:51:55.607 10593-10593/? I/dex2oat: Explicit concurrent copying GC freed 10(15KB) AllocSpace objects, 0(0B) LOS objects, 99% free, 1344B/1537KB, paused 137us total 7.220ms 2019-12-16 14:51:55.625 10593-10593/? I/dex2oat: dex2oat took 190.352ms (147.324ms cpu) (threads: 8) arena alloc=2496B (2496B) java alloc=1344B (1344B) native alloc=751KB (769904B) free=1296KB (1327248B) 2019-12-16 14:51:55.641 10572-10590/? I/Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/tinker_classN.apk, opt file:/data/user/0/tinker.sample.android/tinker/patch-b088f23d/dex/oat/arm64/tinker_classN.odex, opt file size: 17024, use time 261 2019-12-16 14:51:55.641 10572-10590/? I/Tinker.DexDiffPatchInternal: recover dex result:true, cost:282 2019-12-16 14:51:55.646 10572-10590/? W/Tinker.BsDiffPatchInternal: patch recover, library is not contained 2019-12-16 14:51:55.653 10572-10590/? W/Tinker.ResDiffPatchInternal: patch recover, resource is not contained

hsjjs126 commented 4 years ago

试了下用乐固加固,patch合成没问题(对比了下乐固和360加固后的apk包,乐固是最基础的加固,并没有对so包进行加固,360加固等级比较高,怀疑是360加固导致patch合成不成功)

jerry9433 commented 4 years ago

你们打补丁时候的基准包是加固后的还是没加固的?mapping和R文件呢?我用360加固后的包作为基准包,mapping和R都是加固前的,结果打补丁失败了

hsjjs126 commented 4 years ago

你们打补丁时候的基准包是加固后的还是没加固的?mapping和R文件呢?我用360加固后的包作为基准包,mapping和R都是加固前的,结果打补丁失败了

基准包需要是没加固的,我现在这个没问题了,原因是我在app关闭的时候没有将进程杀死导致修复没生效。

zhengzhuoxing commented 4 years ago

@hsjjs126 你的360加固也好了么,怎么解决的啊

hsjjs126 commented 4 years ago

@hsjjs126 你的360加固也好了么,怎么解决的啊

在修复完成后,关闭app的时候需要将进程杀死,修复才会生效。

1136346879 commented 4 years ago

你好 360加固后 补丁包 修复不成功 异常错误信息: 2020-10-26 11:58:56.143 16512-16696/? E/Tinker.DexDiffPatchInternal: apk entry classes.dex crc is not equal, expect crc: 504384381, got crc: 2658342879 2020-10-26 11:58:56.148 16512-16696/? E/Tinker.UpgradePatch: UpgradePatch tryPatch:new patch recover, try patch dex failed

我是用基准包 生成的补丁包
手机安装的加固后的包,貌似吧dex文件给修改了,所以修复不成功