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

现有android 工程中使用tinker,现在想集成Flutter module到现有工程,application 需要怎么修改配置呢。 #1104

Open alex-wei opened 5 years ago

alex-wei commented 5 years ago

Issue/提问须知

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

异常类型:app运行时异常/编译异常

手机型号:如:Nexus 5(如是编译异常,则可以不填)

手机系统版本:如:Android 5.0 (如是编译异常,则可以不填)

tinker版本:如:1.7.7

gradle版本:如:2.10

是否使用热更新SDK: 如 TinkerPatch SDK 或者 Bugly SDK

系统:如:Mac

堆栈/日志:
1. 如是编译异常,请在执行gradle命令时,加上--stacktrace;
2. 日志我们需要过滤"Tinker."关键字;
3. 对于合成失败的情况,请给出:patch进程的日志,这里需要将Android Moniter右上角设为No Filter。

提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没给出任何代码截图报错的,将绝对不会有任何反馈。这种issue也是一律直接关闭的,大家可以参阅提问的智慧

Tinker是一个开源项目,希望大家遇到问题时要学会先思考,看看sample与Tinker的源码,更鼓励大家给我们提pr.

tys282000 commented 5 years ago

如果app的Application必须继承一个父Application,且Flutter的sdk也要求app的Application必须为他指定的父Application,那暂时是无法集成Tinker的。否则把原来的Application里的逻辑放到一个你自己新建的ApplicationLike类里,然后在这个ApplicationLike的注解里按demo的做法配置一下就可以了。

whybux commented 5 years ago

Flutter moudle没有要求Application必须继承flutter的Application。我使用的是继承flutterActivity,所以对Application没影响。 按照之前的正常使用即可。 我已经在项目中使用了。而且也发了一次补丁,补丁也成功了。 建议楼主试一下。

githubjin commented 5 years ago

使用flutter create abc 方式创建的项目,热更新提示成功了,重启之后就是不显示更新之后的内容,愁死个人,哪位大佬帮忙指点一下,谢谢 下面是日志: W/Tinker.TinkerLoader: tryLoadPatchFiles:patch dir not exist:/data/user/0/com.upgrade.example.upgrade_demo/tinker D/Tinker.DefaultAppLike: onBaseContextAttached: I/Tinker.TinkerPatchListener: application maxMemory:256 W/Tinker.Tinker: tinker patch directory: /data/user/0/com.upgrade.example.upgrade_demo/tinker I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.13.2 I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-2, process name:com.upgrade.example.upgrade_demo, main process:true, systemOTA:false, fingerPrint:Xiaomi/capricorn/capricorn:8.0.0/OPR1.170623.032/V10.2.2.0.OAGCNXM:user/release-keys, oatDir:null, useInterpretMode:false W/Tinker.TinkerLoadResult: can't find patch file, is ok, just return I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.upgrade.example.upgrade_demo/tinker, code: -2, cost: 3ms W/Tinker.Tinker: tinker load fail! I/Tinker.ComponentHotplug: method install() is not invoked, ignore ensuring operations. D/Tinker.DefaultAppLike: onCreate I/CrashReport: backup java handler: com.tencent.bugly.beta.tinker.TinkerUncaughtExceptionHandler@2a8d3e1 W/CrashReport: [patch] tinker new id is null ,so patch version is invalid I/CrashReport: TINKER_ID:base-1.0.7 I/CrashReport: NEW_TINKER_ID: W/Tinker.UpgradePatchRetry: onPatchRetryLoad retry info not exist, just return D/CrashReport: app version is: [1.0.7.8], [deviceId:null|null|f8ebe69f8bec5880], channel: [null], base tinkerId:[base-1.0.7], patch tinkerId:[], patch version:[] D/Tinker.TinkerManager: onDownloadSuccess. D/Tinker.TinkerManager: check if has new patch. D/Tinker.TinkerManager: has new patch. D/Tinker.TinkerManager: starting patch. I/Tinker.TinkerPatchListener: receive a patch file: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk, file size:105009 W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch.info (No such file or directory) W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch.info (No such file or directory) W/Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return I/Tinker.TinkerPatchListener: get platform:null I/Tinker.TinkerPatchService: run patch service... D/Boost: hostingType=service, hostingName=com.upgrade.example.upgrade_demo/com.tencent.tinker.lib.service.TinkerPatchService, callerPackage=com.upgrade.example.upgrade_demo, isSystem=false, isBoostNeeded=false. I/ActivityManager: Start proc 758:com.upgrade.example.upgrade_demo:patch/u0a2031 for service com.upgrade.example.upgrade_demo/com.tencent.tinker.lib.service.TinkerPatchService caller=com.upgrade.example.upgrade_demo W/Tinker.TinkerLoader: tryLoadPatchFiles: we don't load patch with :patch process itself, just return D/Tinker.DefaultAppLike: onBaseContextAttached: I/Tinker.TinkerPatchListener: application maxMemory:256 W/Tinker.Tinker: tinker patch directory: /data/user/0/com.upgrade.example.upgrade_demo/tinker I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.13.2 I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-1, process name:com.upgrade.example.upgrade_demo:patch, main process:false, systemOTA:false, fingerPrint:Xiaomi/capricorn/capricorn:8.0.0/OPR1.170623.032/V10.2.2.0.OAGCNXM:user/release-keys, oatDir:null, useInterpretMode:false W/Tinker.TinkerLoadResult: tinker is disable, just return I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.upgrade.example.upgrade_demo/tinker, code: -1, cost: 3ms W/Tinker.Tinker: tinker load fail! I/Tinker.ComponentHotplug: method install() is not invoked, ignore ensuring operations. D/Tinker.DefaultAppLike: onCreate I/CrashReport: backup java handler: com.tencent.bugly.beta.tinker.TinkerUncaughtExceptionHandler@f8b27eb I/Tinker.TinkerPatchService: for system version >= Android O, we just ignore increasingPriority job to avoid crash or toasts. I/Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start W/Tinker.UpgradePatchRetry: try copy file: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk to /data/user/0/com.upgrade.example.upgrade_demo/tinker_temp/temp.apk W/Tinker.UpgradePatchRetry: onPatchRetryLoad retry is not main process, just return I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:a7bebf32dd6b1319935d801c848a44d6 W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch.info (No such file or directory) W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch.info (No such file or directory) I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/user/0/com.upgrade.example.upgrade_demo/tinker/patch-a7bebf32 W/Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk size: 105009, dest file: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch-a7bebf32/patch-a7bebf32.apk size:105009 W/Tinker.DexDiffPatchInternal: patch recover, dex is not contained W/Tinker.BsDiffPatchInternal: success recover bsdiff file: /data/user/0/com.upgrade.example.upgrade_demo/tinker/patch-a7bebf32/lib/lib/armeabi-v7a/libapp.so, use time: 899 I/Tinker.BsDiffPatchInternal: recover lib result:true, cost:908 W/Tinker.ResDiffPatchInternal: patch recover, resource is not contained I/Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.upgrade.example.upgrade_demo/tinker/patch.info , oldVer:, newVer:a7bebf32dd6b1319935d801c848a44d6, isProtectedApp:0, isRemoveNewVersion:0, fingerprint:Xiaomi/capricorn/capricorn:8.0.0/OPR1.170623.032/V10.2.2.0.OAGCNXM:user/release-keys, oatDir:odex I/Tinker.UpgradePatchRetry: onPatchResetMaxCheck, reset max check to 1 W/Tinker.UpgradePatch: UpgradePatch tryPatch: done, it is ok I/Tinker.DefaultPatchReporter: patchReporter onPatchResult: patch all result path: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk, success: true, cost: 1019 I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.upgrade.example.upgrade_demo/tinker_temp/temp.apk I/Tinker.TinkerResultService: TinkerResultService receive result: PatchResult: isSuccess:true rawPatchFilePath:/data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk costTime:1019 patchVersion:a7bebf32dd6b1319935d801c848a44d6 W/Tinker.DefaultTinkerResultService: deleteRawPatchFile rawFile path: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk I/CrashReport: Tinker patch success, result: PatchResult: isSuccess:true rawPatchFilePath:/data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk costTime:1019 patchVersion:a7bebf32dd6b1319935d801c848a44d6 I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.upgrade.example.upgrade_demo/app_tmpPatch/tmpPatch.apk I/Tinker.TinkerResultService: tinker wait screen to restart process

canewsin commented 5 years ago

@githubjin did you succeed in flutter app @whybux how did you acheive that even patch is applied new resources not reflecting Reply in english please If you have a example repo please provide a link