Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Overview

Tinker

license Release Version PRs Welcome WeChat Approved

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk.

tinker.png

Getting started

Add tinker-gradle-plugin as a dependency in your main build.gradle in the root of your project:

buildscript {
    dependencies {
        classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.9.1')
    }
}

Then you need to "apply" the plugin and add dependencies by adding the following lines to your app/build.gradle.

dependencies {
    //optional, help to generate the final application
    provided('com.tencent.tinker:tinker-android-anno:1.9.1')
    //tinker's main Android lib
    compile('com.tencent.tinker:tinker-android-lib:1.9.1')
}
...
...
apply plugin: 'com.tencent.tinker.patch'

If your app has a class that subclasses android.app.Application, then you need to modify that class, and move all its implements to SampleApplicationLike rather than Application:

-public class YourApplication extends Application {
+public class SampleApplicationLike extends DefaultApplicationLike {

Now you should change your Application class, make it a subclass of TinkerApplication. As you can see from its API, it is an abstract class that does not have a default constructor, so you must define a no-arg constructor:

public class SampleApplication extends TinkerApplication {
    public SampleApplication() {
      super(
        //tinkerFlags, which types is supported
        //dex only, library only, all support
        ShareConstants.TINKER_ENABLE_ALL,
        // This is passed as a string so the shell application does not
        // have a binary dependency on your ApplicationLifeCycle class.
        "tinker.sample.android.app.SampleApplicationLike");
    }
}

Use tinker-android-anno to generate your Application is recommended, you just need to add an annotation for your SampleApplicationLike class

@DefaultLifeCycle(
application = "tinker.sample.android.app.SampleApplication",             //application name to generate
flags = ShareConstants.TINKER_ENABLE_ALL)                                //tinkerFlags above
public class SampleApplicationLike extends DefaultApplicationLike

How to install tinker? learn more at the sample SampleApplicationLike.

For proguard, we have already made the proguard config automatic, and tinker will also generate the multiDex keep proguard file for you.

For more tinker configurations, learn more at the sample app/build.gradle.

Ark Support

How to run tinker on the Ark?

building patch

Just use the following command:

bash build_patch_dexdiff.sh old=xxx new=xxx
  • old indicates the absolute path of android apk(not compiled by Ark) with bugs
  • new indicates the absolute path of android apk(not compiled by Ark) with fixing

The patch file is packaged in APK.

compiling in Ark

TODO

At present it's compiled by Ark compiler team. The output patch is still packaged in APK format without signature.

packaging the patch

For tinker-cli, add the following lines to your tinker_config.xml. Otherwise, the default configure will be used.

<issue id="arkHot">
   <path value="arkHot"/>         // path of patch
   <name value="patch.apk"/>      // name of patch
</issue>

For gradle, add the following lines to your app/build.gradle. Otherwise, the default configure will be used.

ark {
   path = "arkHot"         // path of patch
   name = "patch.apk"      // name of patch
}

The patch is compiled by Ark and placed on the above path. all subsequent operations are same as tinker-cli or gradle.

The ultimated patch APK consists of two patch files:

  • classes.dex for android
  • patch.apk with so for Ark.

Tinker Known Issues

There are some issues which Tinker can't dynamic update.

  1. Can't update AndroidManifest.xml, such as add Android Component.
  2. Do not support some Samsung models with os version android-21.
  3. Due to Google Play Developer Distribution Agreement, we can't dynamic update our apk.

Tinker Support

Any problem?

  1. Learn more from tinker-sample-android.
  2. Read the source code.
  3. Read the wiki or FAQ for help.
  4. Contact us for help.

Contributing

For more information about contributing issues or pull requests, see our Tinker Contributing Guide.

License

Tinker is under the BSD license. See the LICENSE file for details.

Comments
  • Odex file: does not exist

    Odex file: does not exist

    Issue/提问须知

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

    异常类型:app运行时异常
    
    手机型号:航盛车机
    
    手机系统版本:Android9.0
    
    tinker版本:如:1.9.14.25
    
    gradle版本:如:4.2.0
    
    是否使用热更新SDK:否
    
    系统:Windows
    
    报错堆栈
    E/Tinker.DefaultPatchReporter: onPatchDexOptFail:  java.io.FileNotFoundException: Odex file: /data/user/0/com.***.***/tinker/patch-b7dc98f7/dex/oat/arm64/tinker_classN.odex does not exist.
           at com.tencent.tinker.loader.TinkerDexOptimizer$OptimizeWorker.run(TinkerDexOptimizer.java:192)
           at com.tencent.tinker.loader.TinkerDexOptimizer.optimizeAll(TinkerDexOptimizer.java:108)
           at com.tencent.tinker.loader.TinkerDexOptimizer.optimizeAll(TinkerDexOptimizer.java:83)
           at com.tencent.tinker.lib.patch.DexDiffPatchInternal.dexOptimizeDexFiles(DexDiffPatchInternal.java:380)
           at com.tencent.tinker.lib.patch.DexDiffPatchInternal.patchDexExtractViaDexDiff(DexDiffPatchInternal.java:196)
           at com.tencent.tinker.lib.patch.DexDiffPatchInternal.tryRecoverDexFiles(DexDiffPatchInternal.java:87)
           at com.tencent.tinker.lib.patch.UpgradePatch.tryPatch(UpgradePatch.java:157)
           at com.tencent.tinker.lib.service.TinkerPatchService.doApplyPatch(TinkerPatchService.java:223)
           at com.tencent.tinker.lib.service.TinkerPatchService.onHandleIntent(TinkerPatchService.java:101)
           at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
           at android.os.Handler.dispatchMessage(Handler.java:106)
           at android.os.Looper.loop(Looper.java:193)
           at android.os.HandlerThread.run(HandlerThread.java:65)
    
    是Android9的车机系统,看了一下代码最终是走了TinkerDexOptimizer.java中的
    patchClassLoaderStrongRef = NewClassLoaderInjector.triggerDex2Oat(context, optimizedDir,
                                        useDLC, dexFile.getAbsolutePath());
    执行完odexFile文件没有生成
     final File odexFile = new File(optimizedPath);
                    if (SharePatchFileUtil.isLegalFile(odexFile) || SharePatchFileUtil.shouldAcceptEvenIfIllegal(odexFile)) {
                        if (callback != null) {
                            callback.onSuccess(dexFile, optimizedDir, odexFile);
                        }
                        return true;
                    } else {
                        final FileNotFoundException e = new FileNotFoundException("Odex file: "
                                + odexFile.getAbsolutePath() + " does not exist.");
                        if (callback != null) {
                            callback.onFailed(dexFile, optimizedDir, e);
                        }
                        return false;
                    }
    我尝试在这里直接让其回调onSuccess,实际是修复成功。这样搞会有问题吗?我看了一下历史代码,之前看起来是会走triggerPMDexOptOnDemand(context, dexFile.getAbsolutePath(), optimizedPath);这段逻辑。
    
    我想的解决方案,一个是直接SharePatchFileUtil.shouldAcceptEvenIfIllegal(odexFile)在这里针对该车机放行,另一个是使其触发triggerPMDexOptOnDemand(context, dexFile.getAbsolutePath(), optimizedPath)。请问哪种方式是稳健的?
    opened by igottime 0
  • 补丁包只生效一次 Tinker Exception:checkDexInstall failed

    补丁包只生效一次 Tinker Exception:checkDexInstall failed

    Issue/提问须知

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

    异常类型:app运行时异常
    
    手机型号:如:荣耀10(如是编译异常,则可以不填)
    
    手机系统版本:如:Android 10 (如是编译异常,则可以不填)
    
    tinker版本:如:1.9.14.25.1
    
    gradle版本:如:7.0.2
    
    是否使用热更新SDK: 否
    
    系统:如:window11
    
    堆栈/日志:
    1. 如是编译异常,请在执行gradle命令时,加上--stacktrace;
    2. 日志我们需要过滤"Tinker."关键字;
    3. 对于合成失败的情况,请给出:patch进程的日志,这里需要将Android Moniter右上角设为No Filter。
    

    2022-12-01 14:42:08.100 3212-3239/? I/Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.hw.tinkerdemo/tinker/patch.info , oldVer:, newVer:bf1c39a6488824b450f905ca374c71b0, isProtectedApp:0, versionToRemove:, fingerprint:HONOR/COL-AL10/HWCOL:10/HUAWEICOL-AL10/10.0.0.179C00:user/release-keys, oatDir:odex, isRemoveInterpretOATDir:0, stack: java.lang.Throwable at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFile(SharePatchInfo.java:184) at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFileWithLock(SharePatchInfo.java:104) at com.tencent.tinker.lib.patch.UpgradePatch.tryPatch(UpgradePatch.java:196) at com.tencent.tinker.lib.service.TinkerPatchService.doApplyPatch(TinkerPatchService.java:223) at com.tencent.tinker.lib.service.TinkerPatchService.onHandleIntent(TinkerPatchService.java:101) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:213) at android.os.HandlerThread.run(HandlerThread.java:67) 2022-12-01 14:42:08.102 3212-3239/? I/Tinker.UpgradePatchRetry: onPatchResetMaxCheck, reset max check to 1

    《---------------------------------------------------------------------------------------》

    2022-12-01 14:42:23.989 3899-3899/? I/Tinker.TinkerDexLoader: classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.hw.tinkerdemo-aj_AZQVYpsvUFW_Jl5HfFw==/base.apk"],nativeLibraryDirectories=[/data/app/com.hw.tinkerdemo-aj_AZQVYpsvUFW_Jl5HfFw==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]] 2022-12-01 14:42:23.989 3899-3899/? I/Tinker.TinkerDexLoader: verify dex file:/data/user/0/com.hw.tinkerdemo/tinker/patch-bf1c39a6/dex/tinker_classN.apk md5, use time: 0 2022-12-01 14:42:23.989 3899-3899/? I/Tinker.ClassLoaderAdder: installDexes dexOptDir: /data/user/0/com.hw.tinkerdemo/tinker/patch-bf1c39a6/odex, dex size:1 2022-12-01 14:42:23.993 3899-3899/? I/Tinker.ClassLoaderAdder: after loaded classloader: com.tencent.tinker.loader.TinkerClassLoader[DexPathList[[zip file "/data/user/0/com.hw.tinkerdemo/tinker/patch-bf1c39a6/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/com.hw.tinkerdemo-aj_AZQVYpsvUFW_Jl5HfFw==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]], dex size:1 2022-12-01 14:42:23.993 3899-3899/? I/Tinker.ClassLoaderAdder: checkDexInstall result: false, checker_classloader: com.tencent.tinker.loader.TinkerClassLoader[DexPathList[[zip file "/data/user/0/com.hw.tinkerdemo/tinker/patch-bf1c39a6/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/com.hw.tinkerdemo-aj_AZQVYpsvUFW_Jl5HfFw==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]] 2022-12-01 14:42:23.994 3899-3899/? E/Tinker.TinkerDexLoader: install dexes failed 2022-12-01 14:42:23.994 3899-3899/? W/Tinker.TinkerLoader: tryLoadPatchFiles:onPatchLoadDexesFail 2022-12-01 14:42:23.998 3899-3899/? D/Tinker.DefaultAppLike: onBaseContextAttached: 2022-12-01 14:42:24.010 3899-3899/? V/Tinker.SamplePatchListener: application maxMemory:384 2022-12-01 14:42:24.015 3899-3899/? W/Tinker.Tinker: tinker patch directory: /data/user/0/com.hw.tinkerdemo/tinker 2022-12-01 14:42:24.017 3899-3899/? I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.14.25.1 2022-12-01 14:42:24.018 3899-3899/? I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-14, process name:com.hw.tinkerdemo, main process:true, systemOTA:false, fingerPrint:HONOR/COL-AL10/HWCOL:10/HUAWEICOL-AL10/10.0.0.179C00:user/release-keys, oatDir:odex, useInterpretMode:false 2022-12-01 14:42:24.018 3899-3899/? I/Tinker.TinkerLoadResult: parseTinkerResult oldVersion:, newVersion:bf1c39a6488824b450f905ca374c71b0, current:bf1c39a6488824b450f905ca374c71b0 2022-12-01 14:42:24.019 3899-3899/? I/Tinker.TinkerLoadResult: Tinker load have exception loadCode:-14 2022-12-01 14:42:24.019 3899-3899/? E/Tinker.DefaultLoadReporter: patch loadReporter onLoadException: tinker dex check fail:Tinker Exception:checkDexInstall failed

    《-----------------------------------------------------------------------------------------------------》 2022-12-01 14:42:24.024 3899-3899/? E/Tinker.DefaultLoadReporter: tinker load exception com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:checkDexInstall failed at com.tencent.tinker.loader.SystemClassLoaderAdder.installDexes(SystemClassLoaderAdder.java:73) at com.tencent.tinker.loader.TinkerDexLoader.loadTinkerJars(TinkerDexLoader.java:191) at com.tencent.tinker.loader.TinkerLoader.tryLoadPatchFilesInternal(TinkerLoader.java:346) at com.tencent.tinker.loader.TinkerLoader.tryLoad(TinkerLoader.java:57) at java.lang.reflect.Method.invoke(Native Method) at com.tencent.tinker.loader.app.TinkerApplication.loadTinker(TinkerApplication.java:125) at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:163) at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:186) at android.app.Application.attach(Application.java:358) at android.app.Instrumentation.newApplication(Instrumentation.java:1161) at android.app.LoadedApk.makeApplication(LoadedApk.java:1296) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7173) at android.app.ActivityThread.access$2200(ActivityThread.java:296) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2208) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:8178) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

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

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

    opened by lao-Driver 1
  • xml修改没有生成差异

    xml修改没有生成差异

    命令行接入,输出日志部分如下 Check for loader classes in dex: classes2.dex Collect class descriptors in classes2.dex Found modify resource: res/-o.xml Found modify resource: res/-Y.xml Found modify resource: res/1N.xml Found modify resource: res/30.xml Found modify resource: res/38.xml Found modify resource: res/43.xml Found modify resource: res/4G.xml Found modify resource: res/5A.xml Found modify resource: res/65.xml Found modify resource: res/66.xml

    其中66.xml是我修改了被识别出来了,但同目录下R5.xml却没有被识别出被修改, 我R5.xml增加了两个button。 这个是需要额外配置吗?

    opened by ingxin 1
  • Tinker: Caused by: java.lang.NoSuchMethodError: No virtual method position(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer;

    Tinker: Caused by: java.lang.NoSuchMethodError: No virtual method position(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer;

    异常类型:app运行时异常
    
    手机型号:锤子坚果pro
    手机系统版本:Android 8.0
    
    tinker版本:如:1.9.14.25.2
    
    gradle版本:如:6.7.1
    
    是否使用热更新SDK: 如 TinkerPatch SDK 或者 Bugly SDK
    
    系统::Mac
    
    堆栈/日志:
    21:41:55.770  7480-7506                                      com.yxl.fish           E  tinker patch exception  com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:patch dex extract failed (No virtual method position(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)).
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.extractDexDiffInternals(DexDiffPatchInternal.java:614)
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.patchDexExtractViaDexDiff(DexDiffPatchInternal.java:172)
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.tryRecoverDexFiles(DexDiffPatchInternal.java:87)
                                                                                           	at com.tencent.tinker.lib.patch.UpgradePatch.tryPatch(UpgradePatch.java:172)
                                                                                           	at com.tencent.tinker.lib.service.TinkerPatchService.doApplyPatch(TinkerPatchService.java:223)
                                                                                           	at com.tencent.tinker.lib.service.TinkerPatchService.onHandleIntent(TinkerPatchService.java:101)
                                                                                           	at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
                                                                                           	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                           	at android.os.Looper.loop(Looper.java:167)
                                                                                           	at android.os.HandlerThread.run(HandlerThread.java:65)
                                                                                           Caused by: java.lang.NoSuchMethodError: No virtual method position(I)Ljava/nio/ByteBuffer; in class Ljava/nio/ByteBuffer; or its super classes (declaration of 'java.nio.ByteBuffer' appears in /system/framework/core-oj.jar)
                                                                                           	at com.tencent.tinker.android.dex.Dex.openSection(Dex.java:232)
                                                                                           	at com.tencent.tinker.android.dex.TableOfContents.readFrom(TableOfContents.java:145)
                                                                                           	at com.tencent.tinker.android.dex.Dex.loadFrom(Dex.java:171)
                                                                                           	at com.tencent.tinker.android.dex.Dex.loadFrom(Dex.java:164)
                                                                                           	at com.tencent.tinker.android.dex.Dex.<init>(Dex.java:94)
                                                                                           	at com.tencent.tinker.commons.dexpatcher.DexPatchApplier.<init>(DexPatchApplier.java:96)
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.patchDexFile(DexDiffPatchInternal.java:740)
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.extractDexDiffInternals(DexDiffPatchInternal.java:597)
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.patchDexExtractViaDexDiff(DexDiffPatchInternal.java:172) 
                                                                                           	at com.tencent.tinker.lib.patch.DexDiffPatchInternal.tryRecoverDexFiles(DexDiffPatchInternal.java:87) 
                                                                                           	at com.tencent.tinker.lib.patch.UpgradePatch.tryPatch(UpgradePatch.java:172) 
                                                                                           	at com.tencent.tinker.lib.service.TinkerPatchService.doApplyPatch(TinkerPatchService.java:223) 
                                                                                           	at com.tencent.tinker.lib.service.TinkerPatchService.onHandleIntent(TinkerPatchService.java:101) 
                                                                                           	at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76) 
                                                                                           	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                           	at android.os.Looper.loop(Looper.java:167) 
                                                                                           	at android.os.HandlerThread.run(HandlerThread.java:65) 
    opened by TopBigOne 0
  • SystemClassLoaderAdder.checkDexInstall返回false导致加载patch失败并删除掉合成后的补丁

    SystemClassLoaderAdder.checkDexInstall返回false导致加载patch失败并删除掉合成后的补丁

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

    手机型号:如:RedMi

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

    tinker版本:如:1.9.14.25.1

    gradle版本:如:4.10.3

    是否使用热更新SDK: TinkerPatch SDK

    系统:Mac

    Log:2022-11-23 15:04:10.368 11299-11299/com.xxxxx.activity D/Tinker.TinkerInternals: same fingerprint:Redmi/chopin/chopin:11/RP1A.200720.011/V12.5.5.0.RKPCNXM:user/release-keys 2022-11-23 15:04:10.368 11299-11299/com.x x x x x.activity W/Tinker.TinkerInternals: getSafeModeCount: recFileName:safemode_count_rec_com.xxxxx.activity failed, return 0 instead. 2022-11-23 15:04:10.369 11299-11299/com.xxxxx.activity I/Tinker.TinkerInternals: setSafeModeCount: count: 1 2022-11-23 15:04:10.369 11299-11299/com.xxxxx.activity I/Tinker.TinkerDexLoader: classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/lib/arm64, /data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]] 2022-11-23 15:04:10.369 11299-11299/com.xxxxx.activity I/Tinker.TinkerDexLoader: verify dex file:/data/user/0/com.xxxxx.activity/tinker/patch-3cadb0ab/dex/tinker_classN.apk md5, use time: 0 2022-11-23 15:04:10.369 11299-11299/com.xxxxx.activity I/Tinker.ClassLoaderAdder: installDexes dexOptDir: /data/user/0/com.xxxxx.activity/tinker/patch-3cadb0ab/odex, dex size:1 2022-11-23 15:04:10.376 11299-11299/com.xxxxx.activity I/Tinker.ClassLoaderAdder: after loaded classloader: dalvik.system.DelegateLastClassLoader[DexPathList[[zip file "/data/user/0/com.xxxxx.activity/tinker/patch-3cadb0ab/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/lib/arm64, /data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]], dex size:1 2022-11-23 15:04:10.376 11299-11299/com.xxxxx.activity I/Tinker.ClassLoaderAdder: checkDexInstall result: false, checker_classloader: dalvik.system.DelegateLastClassLoader[DexPathList[[zip file "/data/user/0/com.xxxxx.activity/tinker/patch-3cadb0ab/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/lib/arm64, /data/app/~~ENs-pZzQPqaICMN1pUyFUQ==/com.xxxxx.activity-AK7qGpzt7v98SVwd-dtldQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]] 2022-11-23 15:04:10.376 11299-11299/com.xxxxx.activity E/Tinker.TinkerDexLoader: install dexes failed 2022-11-23 15:04:10.376 11299-11299/com.xxxxx.activity W/Tinker.TinkerLoader: tryLoadPatchFiles:onPatchLoadDexesFail 2022-11-23 15:04:10.426 11299-11299/com.xxxxx.activity I/Tinker.TinkerInternals: setSafeModeCount: count: 0 2022-11-23 15:04:10.556 11299-11299/com.xxxxx.activity E/Reflection: reflect bootstrap failed:

    opened by tianzhilanat2010 5
  • 补丁包只生效一次的问题。checkDexInstall = false

    补丁包只生效一次的问题。checkDexInstall = false

    Issue/提问须知

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

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

    手机型号:荣耀等

    手机系统版本:如:Android 10

    tinker版本:1.9.14.25 agp 版本: 4.2.2 gradle版本:gradle-6.9.1-all

    是否使用热更新SDK:是

    系统:Mac

    问题原因: TinkerTestDexLoad.isPatch = false 打补丁包是否成功:成功 补丁包生效状况:打完补丁后重启生效,再次重启失效。 原因分析简述: test.dex 被改名为 class23.dex,导致重启后排序被放到了最后,class23.dex 内部的 TinkerTestDexLoad isPatch = true被前面 class10.dex(这个是 TinkerTestDexLoad 在基准包中的 的 dex 文件) 覆盖了导致 isPatch = false。

    关于这个问题的其他 issue: https://github.com/Tencent/tinker/issues/1680, 这个issue 跟我这个应该是同一个问题,里面给了临时的解决方案。不过既然 tinker 这么设计,肯定是有他的道理。直接跳过 checkDexInstall 只是临时的一个方案。

    ### 现在我的疑问在于,我看了tinker 相关的源码,发现现在的现象是符合预期的,也就是按照源码里的流程,UpgradePatch 里 会把 补丁包中test.dex 改名为 classesN.dex(在我这里是 classes23.dex),然后 再次启动时 TinkerLoader install 的时候,SystemClassLoaderAdder 排序后 classes23.dex 被排到了最后优先级是最低的(这里即使还是 test.dex 也会被排在最后)。 所以有大佬能帮忙解答一下我的疑问吗?** test.dex 经过上面的处理后,在所有 dex 文件中排到了最后一个,那么他的TinkerTestDexLoad 类就会被排在前面基准包里的 TinkerTestDexLoad isPatch = false 覆盖,导致 checkDexInstall = false,补丁包安装失败。所以是哪里出问题了呢**。

    打补丁包日志:

    2022-11-21 11:08:32.167 com.my.package W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.my.package/tinker/patch.info: open failed: ENOENT (No such file or directory)
    2022-11-21 11:08:32.167 com.my.package W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.my.package/tinker/patch.info: open failed: ENOENT (No such file or directory)
    2022-11-21 11:08:32.168 com.my.package W/Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return
    2022-11-21 11:08:32.173 com.my.package I/Tinker.TinkerPatchService: run patch service...
    2022-11-21 11:08:32.899 com.my.package D/Tinker.TinkerLoader: tryLoad test test
    2022-11-21 11:08:32.901 com.my.package W/Tinker.TinkerLoader: tryLoadPatchFiles: we don't load patch with :patch process itself, just return
    2022-11-21 11:08:32.905 com.my.package D/Tinker.DefaultAppLike: onBaseContextAttached:
    2022-11-21 11:08:32.910 com.my.package W/Tinker.Tinker: tinker patch directory: /data/user/0/com.my.package/tinker
    2022-11-21 11:08:32.912 com.my.package I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.14.25
    2022-11-21 11:08:32.912 com.my.package I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-1, process name:com.my.package:patch, main process:false, systemOTA:false, fingerPrint:HONOR/HLK-AL00/HWHLK-H:10/HONORHLK-AL00/102.0.0.270C00:user/release-keys, oatDir:null, useInterpretMode:false
    2022-11-21 11:08:32.912 com.my.package W/Tinker.TinkerLoadResult: tinker is disable, just return
    2022-11-21 11:08:32.913 com.my.package I/Tinker.My: MyLoadReporter onLoadResult -1
    2022-11-21 11:08:32.913 com.my.package I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.my.package/tinker, code: -1, cost: 2ms
    2022-11-21 11:08:32.913 com.my.package W/Tinker.Tinker: tinker load fail!
    2022-11-21 11:08:32.913 com.my.package D/Tinker.DefaultAppLike: onCreate
    2022-11-21 11:08:32.944 com.my.package I/Tinker.TinkerPatchService: for system version >= Android O, we just ignore increasingPriority job to avoid crash or toasts.
    2022-11-21 11:08:32.945 com.my.package I/Tinker.My: MyPatchReporter onPatchServiceStart
    2022-11-21 11:08:32.946 com.my.package I/Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start
    2022-11-21 11:08:32.947 com.my.package D/Tinker.TinkerLoader: [PendingLog @ 2022-11-21 11:08:32.899] tryLoad test test
    2022-11-21 11:08:32.947 com.my.package W/Tinker.TinkerLoader: [PendingLog @ 2022-11-21 11:08:32.901] tryLoadPatchFiles: we don't load patch with :patch process itself, just return
    2022-11-21 11:08:32.948 com.my.package D/Tinker.DefaultAppLike: [PendingLog @ 2022-11-21 11:08:32.905] onBaseContextAttached:
    2022-11-21 11:08:32.960 com.my.package W/Tinker.UpgradePatchRetry: try copy file: /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk to /data/user/0/com.my.package/tinker_temp/temp.apk
    2022-11-21 11:08:33.042 com.my.package I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:f3027dc220a962f988e3bc8b17ce7020
    2022-11-21 11:08:33.043 com.my.package W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.my.package/tinker/patch.info: open failed: ENOENT (No such file or directory)
    2022-11-21 11:08:33.043 com.my.package W/Tinker.PatchInfo: read property failed, e:java.io.FileNotFoundException: /data/user/0/com.my.package/tinker/patch.info: open failed: ENOENT (No such file or directory)
    2022-11-21 11:08:33.044 com.my.package I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/user/0/com.my.package/tinker/patch-f3027dc2
    2022-11-21 11:08:33.044 com.my.package W/Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk size: 4932, dest file: /data/user/0/com.my.package/tinker/patch-f3027dc2/patch-f3027dc2.apk size:4932
    2022-11-21 11:08:33.049 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes18.dex.jar
    2022-11-21 11:08:33.054 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:33.055 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes9.dex.jar
    2022-11-21 11:08:33.060 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:33.061 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes8.dex.jar
    2022-11-21 11:08:33.063 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:33.064 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes19.dex.jar
    2022-11-21 11:08:33.912 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:33.993 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes22.dex.jar
    2022-11-21 11:08:34.088 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:34.096 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes21.dex.jar
    2022-11-21 11:08:34.213 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:34.230 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes20.dex.jar
    2022-11-21 11:08:35.145 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.234 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes11.dex.jar
    2022-11-21 11:08:35.236 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.237 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes10.dex.jar
    2022-11-21 11:08:35.241 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.242 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes12.dex.jar
    2022-11-21 11:08:35.245 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.246 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes3.dex.jar
    2022-11-21 11:08:35.354 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.363 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes2.dex.jar
    2022-11-21 11:08:35.475 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:35.487 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes13.dex.jar
    2022-11-21 11:08:35.490 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.609 com.my.package W/Tinker.DexDiffPatchInternal: success recover dex file: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes.dex.jar, size: 4272772, use time: 2118
    2022-11-21 11:08:37.609 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes17.dex.jar
    2022-11-21 11:08:37.613 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.614 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes6.dex.jar
    2022-11-21 11:08:37.620 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.622 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes7.dex.jar
    2022-11-21 11:08:37.623 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.624 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes16.dex.jar
    2022-11-21 11:08:37.629 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.644 com.my.package W/Tinker.DexDiffPatchInternal: success recover dex file: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes14.dex.jar, size: 18214, use time: 15
    2022-11-21 11:08:37.645 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes5.dex.jar
    2022-11-21 11:08:37.648 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.649 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes4.dex.jar
    2022-11-21 11:08:37.653 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.654 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes15.dex.jar
    2022-11-21 11:08:37.658 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:37.659 com.my.package I/Tinker.DexDiffPatchInternal: try Extracting /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/test.dex.jar
    2022-11-21 11:08:37.660 com.my.package I/Tinker.DexDiffPatchInternal: isExtractionSuccessful: true
    2022-11-21 11:08:38.150 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes12.dex.jar
    2022-11-21 11:08:38.150 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes13.dex.jar
    2022-11-21 11:08:38.150 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes11.dex.jar
    2022-11-21 11:08:38.150 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes18.dex.jar
    2022-11-21 11:08:38.151 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes3.dex.jar
    2022-11-21 11:08:38.151 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes2.dex.jar
    2022-11-21 11:08:38.151 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes.dex.jar
    2022-11-21 11:08:38.152 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes14.dex.jar
    2022-11-21 11:08:38.152 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes6.dex.jar
    2022-11-21 11:08:38.152 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes4.dex.jar
    2022-11-21 11:08:38.153 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/test.dex.jar
    2022-11-21 11:08:38.153 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes8.dex.jar
    2022-11-21 11:08:38.153 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes5.dex.jar
    2022-11-21 11:08:38.153 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes10.dex.jar
    2022-11-21 11:08:38.153 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes20.dex.jar
    2022-11-21 11:08:38.154 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes15.dex.jar
    2022-11-21 11:08:38.154 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes19.dex.jar
    2022-11-21 11:08:38.155 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes7.dex.jar
    2022-11-21 11:08:38.155 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes16.dex.jar
    2022-11-21 11:08:38.155 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes9.dex.jar
    2022-11-21 11:08:38.156 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes22.dex.jar
    2022-11-21 11:08:38.156 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes21.dex.jar
    2022-11-21 11:08:38.156 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/classes17.dex.jar
    2022-11-21 11:08:38.156 com.my.package I/Tinker.DexDiffPatchInternal: merge classN dex file /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk, result: true, size: 39160685, use: 496ms
    2022-11-21 11:08:38.157 com.my.package I/Tinker.DexDiffPatchInternal: legal files to do dexopt: [/data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk]
    2022-11-21 11:08:38.157 com.my.package D/Tinker.TinkerInternals: getCurrentInstructionSet:arm64
    2022-11-21 11:08:38.158 com.my.package I/Tinker.DexDiffPatchInternal: patch recover, try to optimize dex file count:1, optimizeDexDirectory:/data/user/0/com.my.package/tinker/patch-f3027dc2/odex/
    2022-11-21 11:08:38.160 com.my.package I/Tinker.DexDiffPatchInternal: start to parallel optimize dex /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk, size: 39160685
    2022-11-21 11:08:38.160 com.my.package I/Tinker.ParallelDex: Creating fake odex path structure.
    2022-11-21 11:08:38.594 com.my.package I/Tinker.ParallelDex: [+] Hit target device, do dexopt logic now.
    2022-11-21 11:08:38.594 com.my.package I/Tinker.ParallelDex: [+] Execute shell cmd, args: [compile, -f, --secondary-dex, -m, speed-profile, com.my.package]
    2022-11-21 11:08:42.393 com.my.package I/Tinker.ParallelDex: [+] Execute shell cmd done.
    2022-11-21 11:08:42.393 com.my.package I/Tinker.ParallelDex: [+] File /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64/tinker_classN.vdex was found.
    2022-11-21 11:08:42.394 com.my.package I/Tinker.DexDiffPatchInternal: success to parallel optimize dex /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk, opt file:/data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64/tinker_classN.odex, opt file size: 646800, use time 4234
    2022-11-21 11:08:42.394 com.my.package I/Tinker.DexDiffPatchInternal: recover dex result:true, cost:9348
    2022-11-21 11:08:42.395 com.my.package W/Tinker.BsDiffPatchInternal: patch recover, library is not contained
    2022-11-21 11:08:42.397 com.my.package W/Tinker.ResDiffPatchInternal: patch recover, resource is not contained
    2022-11-21 11:08:42.397 com.my.package I/Tinker.DexDiffPatchInternal: raw dex count: 23, dex opt dex count: 1, final wait times: 120
    2022-11-21 11:08:42.401 com.my.package I/Tinker.DexDiffPatchInternal: check dex optimizer file exist: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64/tinker_classN.odex, size 646800
    2022-11-21 11:08:42.402 com.my.package I/Tinker.DexDiffPatchInternal: check dex optimizer file format: tinker_classN.odex, size 646800
    2022-11-21 11:08:42.405 com.my.package I/Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.my.package/tinker/patch.info , oldVer:, newVer:f3027dc220a962f988e3bc8b17ce7020, isProtectedApp:0, versionToRemove:, fingerprint:HONOR/HLK-AL00/HWHLK-H:10/HONORHLK-AL00/102.0.0.270C00:user/release-keys, oatDir:odex, isRemoveInterpretOATDir:0, stack: java.lang.Throwable
            at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFile(SharePatchInfo.java:184)
            at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFileWithLock(SharePatchInfo.java:104)
            at com.tencent.tinker.lib.patch.UpgradePatch.tryPatch(UpgradePatch.java:196)
            at com.my.package.tinker.my.MyUpgradePatch.tryPatch(MyUpgradePatch.kt:24)
            at com.tencent.tinker.lib.service.TinkerPatchService.doApplyPatch(TinkerPatchService.java:223)
            at com.tencent.tinker.lib.service.TinkerPatchService.onHandleIntent(TinkerPatchService.java:101)
            at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78)
            at android.os.Handler.dispatchMessage(Handler.java:110)
            at android.os.Looper.loop(Looper.java:219)
            at android.os.HandlerThread.run(HandlerThread.java:67)
    2022-11-21 11:08:42.406 com.my.package I/Tinker.UpgradePatchRetry: onPatchResetMaxCheck, reset max check to 1
    2022-11-21 11:08:42.407 com.my.package W/Tinker.UpgradePatch: UpgradePatch tryPatch: done, it is ok
    2022-11-21 11:08:42.407 com.my.package I/Tinker.My: MyPatchReporter onPatchResult true, /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk
    2022-11-21 11:08:42.407 com.my.package I/Tinker.DefaultPatchReporter: patchReporter onPatchResult: patch all result path: /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk, success: true, cost: 9426
    2022-11-21 11:08:42.407 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker_temp/temp.apk
    2022-11-21 11:08:42.425 com.my.package V/Tinker.SampleResultService: SampleResultService receive result: 
        PatchResult: 
        isSuccess:true
        rawPatchFilePath:/storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk
        costTime:9426
        dexoptTriggerTime:1669000118158
        isOatGenerated:true
        patchVersion:f3027dc220a962f988e3bc8b17ce7020
    2022-11-21 11:08:42.427 com.my.package W/Tinker.DefaultTinkerResultService: deleteRawPatchFile rawFile path: /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk
    2022-11-21 11:08:42.427 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /storage/emulated/0/Android/data/com.my.package/files/tinker/app-debug-patch_signed.apk
    2022-11-21 11:08:42.427 com.my.package V/Tinker.SampleResultService: tinker wait screen to restart process
    

    重启后日志:

    2022-11-21 11:12:02.438 com.my.package D/Tinker.TinkerLoader: tryLoad test test
    2022-11-21 11:12:02.470 com.my.package D/Tinker.TinkerInternals: getCurrentInstructionSet:arm64
    2022-11-21 11:12:02.470 com.my.package W/Tinker.TinkerLoader: tryLoadPatchFiles:isEnabledForResource:true
    2022-11-21 11:12:02.471 com.my.package D/Tinker.TinkerInternals: same fingerprint:HONOR/HLK-AL00/HWHLK-H:10/HONORHLK-AL00/102.0.0.270C00:user/release-keys
    2022-11-21 11:12:02.471 com.my.package W/Tinker.TinkerInternals: getSafeModeCount: recFileName:safemode_count_rec_com.my.package failed, return 0 instead.
    2022-11-21 11:12:02.472 com.my.package I/Tinker.TinkerInternals: setSafeModeCount: count: 1
    2022-11-21 11:12:02.472 com.my.package I/Tinker.TinkerDexLoader: classloader: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/lib/arm64, /data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]]
    2022-11-21 11:12:02.473 com.my.package I/Tinker.TinkerDexLoader: verify dex file:/data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk md5, use time: 0
    2022-11-21 11:12:02.473 com.my.package I/Tinker.ClassLoaderAdder: installDexes dexOptDir: /data/user/0/com.my.package/tinker/patch-f3027dc2/odex, dex size:1
    2022-11-21 11:12:02.483 com.my.package I/Tinker.ClassLoaderAdder: after loaded classloader: dalvik.system.DelegateLastClassLoader[DexPathList[[zip file "/data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/lib/arm64, /data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]], dex size:1
    2022-11-21 11:12:02.488 com.my.package I/Tinker.ClassLoaderAdder: checkDexInstall result: false, checker_classloader: dalvik.system.DelegateLastClassLoader[DexPathList[[zip file "/data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk"],nativeLibraryDirectories=[/data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/lib/arm64, /data/app/com.my.package-47CW_Wv7r7KMm2hdXtXPsA==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]]
    2022-11-21 11:12:02.488 com.my.package E/Tinker.TinkerDexLoader: install dexes failed
    2022-11-21 11:12:02.488 com.my.package W/Tinker.TinkerLoader: tryLoadPatchFiles:onPatchLoadDexesFail
    2022-11-21 11:12:02.494 com.my.package D/Tinker.DefaultAppLike: onBaseContextAttached:
    2022-11-21 11:12:02.514 com.my.package W/Tinker.Tinker: tinker patch directory: /data/user/0/com.my.package/tinker
    2022-11-21 11:12:02.514 com.my.package I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.9.14.25
    2022-11-21 11:12:02.515 com.my.package I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-14, process name:com.my.package, main process:true, systemOTA:false, fingerPrint:HONOR/HLK-AL00/HWHLK-H:10/HONORHLK-AL00/102.0.0.270C00:user/release-keys, oatDir:odex, useInterpretMode:false
    2022-11-21 11:12:02.515 com.my.package I/Tinker.TinkerLoadResult: parseTinkerResult oldVersion:, newVersion:f3027dc220a962f988e3bc8b17ce7020, current:f3027dc220a962f988e3bc8b17ce7020
    2022-11-21 11:12:02.516 com.my.package I/Tinker.TinkerLoadResult: Tinker load have exception loadCode:-14
    2022-11-21 11:12:02.516 com.my.package I/Tinker.My: MyLoadReporter onLoadException -2, com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:checkDexInstall failed
    2022-11-21 11:12:02.516 com.my.package E/Tinker.DefaultLoadReporter: patch loadReporter onLoadException: tinker dex check fail:Tinker Exception:checkDexInstall failed
    2022-11-21 11:12:02.523 com.my.package I/Tinker.DefaultLoadReporter: dex exception disable tinker forever with sp
    2022-11-21 11:12:02.523 com.my.package E/Tinker.DefaultLoadReporter: tinker load exception, welcome to submit issue to us: https://github.com/Tencent/tinker/issues
    2022-11-21 11:12:02.524 com.my.package E/Tinker.DefaultLoadReporter: tinker load exception  com.tencent.tinker.loader.TinkerRuntimeException: Tinker Exception:checkDexInstall failed
            at com.tencent.tinker.loader.SystemClassLoaderAdder.installDexes(SystemClassLoaderAdder.java:73)
            at com.tencent.tinker.loader.TinkerDexLoader.loadTinkerJars(TinkerDexLoader.java:191)
            at com.tencent.tinker.loader.TinkerLoader.tryLoadPatchFilesInternal(TinkerLoader.java:346)
            at com.tencent.tinker.loader.TinkerLoader.tryLoad(TinkerLoader.java:57)
            at com.my.package.tinker.my.MyTinkerLoader.tryLoad(MyTinkerLoader.kt:20)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.tencent.tinker.loader.app.TinkerApplication.loadTinker(TinkerApplication.java:125)
            at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:163)
            at com.my.package.TinkerApp.onBaseContextAttached(TinkerApp.kt:26)
            at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:186)
            at android.app.Application.attach(Application.java:358)
            at android.app.Instrumentation.newApplication(Instrumentation.java:1168)
            at android.app.LoadedApk.makeApplication(LoadedApk.java:1451)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7554)
            at android.app.ActivityThread.access$2600(ActivityThread.java:260)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435)
            at android.os.Handler.dispatchMessage(Handler.java:110)
            at android.os.Looper.loop(Looper.java:219)
            at android.app.ActivityThread.main(ActivityThread.java:8668)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
    2022-11-21 11:12:02.524 com.my.package I/Tinker.My: MyLoadReporter checkAndCleanPatch
    2022-11-21 11:12:02.525 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/patch-f3027dc2.apk
    2022-11-21 11:12:02.525 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64/tinker_classN.odex
    2022-11-21 11:12:02.525 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64/tinker_classN.vdex
    2022-11-21 11:12:02.526 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/arm64
    2022-11-21 11:12:02.526 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/tinker_classN.apk.cur.prof
    2022-11-21 11:12:02.526 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat/tinker_classN.apk.prof
    2022-11-21 11:12:02.526 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/oat
    2022-11-21 11:12:02.527 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex/tinker_classN.apk
    2022-11-21 11:12:02.527 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/dex
    2022-11-21 11:12:02.527 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2/odex
    2022-11-21 11:12:02.527 com.my.package I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/user/0/com.my.package/tinker/patch-f3027dc2
    2022-11-21 11:12:02.529 com.my.package I/Tinker.PatchInfo: rewritePatchInfoFile file path:/data/user/0/com.my.package/tinker/patch.info , oldVer:, newVer:, isProtectedApp:0, versionToRemove:, fingerprint:HONOR/HLK-AL00/HWHLK-H:10/HONORHLK-AL00/102.0.0.270C00:user/release-keys, oatDir:odex, isRemoveInterpretOATDir:0, stack: java.lang.Throwable
            at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFile(SharePatchInfo.java:184)
            at com.tencent.tinker.loader.shareutil.SharePatchInfo.rewritePatchInfoFileWithLock(SharePatchInfo.java:104)
            at com.tencent.tinker.loader.shareutil.ShareTinkerInternals.cleanPatch(ShareTinkerInternals.java:745)
            at com.tencent.tinker.lib.tinker.Tinker.cleanPatch(Tinker.java:258)
            at com.tencent.tinker.lib.reporter.DefaultLoadReporter.checkAndCleanPatch(DefaultLoadReporter.java:307)
            at com.my.package.tinker.my.MyLoadReporter.checkAndCleanPatch(MyLoadReporter.kt:96)
            at com.tencent.tinker.lib.reporter.DefaultLoadReporter.onLoadException(DefaultLoadReporter.java:280)
            at com.my.package.tinker.my.MyLoadReporter.onLoadException(MyLoadReporter.kt:52)
            at com.tencent.tinker.lib.tinker.TinkerLoadResult.parseTinkerResult(TinkerLoadResult.java:142)
            at com.tencent.tinker.lib.tinker.Tinker.install(Tinker.java:152)
            at com.tencent.tinker.lib.tinker.TinkerInstaller.install(TinkerInstaller.java:71)
            at com.my.package.tinker.TinkerManager.installTinker(TinkerManager.java:119)
            at com.my.package.IllusionApp.onBaseContextAttached(IllusionApp.kt:92)
            at com.tencent.tinker.entry.TinkerApplicationInlineFence.handleMessageImpl(TinkerApplicationInlineFence.java:72)
            at com.tencent.tinker.entry.TinkerApplicationInlineFence.handleMessage_$noinline$(TinkerApplicationInlineFence.java:60)
            at com.tencent.tinker.entry.TinkerApplicationInlineFence.handleMessage(TinkerApplicationInlineFence.java:53)
            at com.tencent.tinker.loader.app.TinkerInlineFenceAction.callOnBaseContextAttached(TinkerInlineFenceAction.java:47)
            at com.tencent.tinker.loader.app.TinkerApplication.onBaseContextAttached(TinkerApplication.java:168)
            at com.my.package.TinkerApp.onBaseContextAttached(TinkerApp.kt:26)
            at com.tencent.tinker.loader.app.TinkerApplication.attachBaseContext(TinkerApplication.java:186)
            at android.app.Application.attach(Application.java:358)
            at android.app.Instrumentation.newApplication(Instrumentation.java:1168)
            at android.app.LoadedApk.makeApplication(LoadedApk.java:1451)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7554)
            at android.app.ActivityThread.access$2600(ActivityThread.java:260)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435)
            at android.os.Handler.dispatchMessage(Handler.java:110)
            at android.os.Looper.loop(Looper.java:219)
            at android.app.ActivityThread.main(ActivityThread.java:8668)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
    2022-11-21 11:12:02.534 com.my.package W/Tinker.PatchInfo: path info file  corrupted:/data/user/0/com.my.package/tinker/patch.info
    2022-11-21 11:12:02.536 com.my.package W/Tinker.PatchInfo: path info file  corrupted:/data/user/0/com.my.package/tinker/patch.info
    2022-11-21 11:12:02.538 com.my.package I/Tinker.My: MyLoadReporter onLoadResult -14
    2022-11-21 11:12:02.539 com.my.package I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/user/0/com.my.package/tinker, code: -14, cost: 50ms
    2022-11-21 11:12:02.539 com.my.package W/Tinker.Tinker: tinker load fail!
    2022-11-21 11:12:02.539 com.my.package I/Tinker.TinkerInternals: setSafeModeCount: count: 0
    2022-11-21 11:12:02.582 ? D/Tinker.DefaultAppLike: onCreate
    opened by tennkou 2
Releases(v1.9.14.25.1)
  • v1.9.14.25.1(Sep 22, 2022)

    Bugfix & ChangeLog

    1. 修复了 anim 资源新增、修改检测逻辑,在 anim 资源发生新增或修改时会中断编译。
    2. 获取当前进程名的方法在 api level >= 18 的机器上优先使用反射 ActivityThread 的方式实现,若失败则改用 BufferedReader 读 proc 的方式实现。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.25(Sep 16, 2022)

    Bugfix & ChangeLog

    1. 增加了32位 Android N 及更旧的系统上使用解释模式触发 dexopt 的开关以帮助减少 32位上 VmSize 的开销。
    2. 修复部分机型上资源有变更时 patch 失败的问题。
    3. base包更新或有新 patch 合成成功后删除老 patch 的逻辑改为异步实现以降低启动耗时。
    4. dexopt 触发重试次数缩减到 10 次,避免部分机型 apply patch 耗时太长。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.24(Aug 8, 2022)

    Bugfix & ChangeLog

    1. 修复了 R8 生成的特殊 DebugInfo 导致编译失败的问题。
    2. 增加 performSecondaryDexOpt 的重试次数,在重试失败后再尝试 registerDexModule,以尽量减小 Android R 上 odex 没有生成导致的性能开销。
    3. 在 performSecondaryDexOpt 重试无效前不在 OPPO、VIVO、XIAOMI、REDMI 的 Android S 或更新的系统上调 registerDexModule,规避已知的性能问题。
    4. 更新 getProcessName 的实现,在 Android P 及更新的系统上优先尝试 Application.getProcessName() 方法。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.23.1(Aug 5, 2022)

  • v1.9.14.23(Jul 27, 2022)

    Bugfix & ChangeLog

    1. 优化了判断 resources.apk 被意外修改导致资源 patch 失效的检测逻辑。
    2. 修复了连续两次 patch 中间更新了 base 包时可能导致最后一次 patch 失效的问题。
    3. 在 Patch 加载不成功时 installNativeLibraryABIWithoutTinkerInstalled() 方法不再注入 patch so 路径,避免 dex 和 so 不一致的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.22(Jul 11, 2022)

  • v1.9.14.21(Jul 11, 2022)

    Bugfix & ChangeLog

    1. 尝试修复极少数情况下因为 resources.apk 被意外修改导致 patch 后的资源找不到或失效的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.20(Apr 25, 2022)

    Bugfix & ChangeLog

    1. 修复了 OPPO & VIVO 部分机型加载 Tinker 时偶现的闪退问题。
    2. 增加了 Patch Dex 的 Dex2Oat 重试次数,以降低解释模式加载 Patch Dex 的概率。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.19(Jan 13, 2022)

    Bugfix & ChangeLog

    1. 修复了资源文件名中含有 % 时导致编译失败的问题。
    2. 修复了 OPPO、三星 Android S 机器上加载 patch 可能会导致 crash 的问题。
    3. Secondary dex2oat 触发方式和使用的 compile-filter 综合了字节分享的文章、 OPPO、三星方面给出的建议进行了调整,调整后理论上能同时解决 Android R 的卡顿和 Android S 上的部分 crash 问题。
    4. 重新支持了 AGP 7.0 和 R8。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.18(Sep 14, 2021)

    Bugfix & ChangeLog

    1. 修复了 Patch 合成阶段在 Android O 之前的系统上可能会导致被 Patch 类和旧类同时被加载的问题。
    2. 在 secondary dexopt hack 时将 compile filter 改成 speed 以避免 Android R 机型加载 Patch 后启动慢的问题。
    3. 在 Android S 上不做 secondary dexopt hack 以避免重启后 Patch Dex 加载失败。
    4. 若 app 手动指定了 aapt2 stableIds 文件路径,则 Tinker 不再自动注入生成的 stableIds 文件路径。
    5. 以更精准的方式判断 Patch Service 是否正在运行,并开启 Patch Service 意外退出后自动重启,以提高 Patch 成功率。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.17(Jun 12, 2021)

    注意

    因 Bintray 和 JCenter 已停止服务,Tinker 已将包含此版本在内的所有版本迁移到了 MavenCentral。若升级后编译失败,请在项目根目录的 build.gradle 中增加 mavenCentral() 这个 Repo 后重新编译一次。

    Bugfix & ChangeLog

    1. Fix: TinkerInlineFence 中可能出现的 Message 泄漏。
    2. 在 Android R 上开启 secondary dexopt hack 以解决部分 Android R 机型加载 patch 后启动慢的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.16(Apr 19, 2021)

    注意

    从此版本开始 Tinker 将不再发布到 bintray,如升级后编译提示找不到 1.9.14.16 版本,请在项目根目录的 build.gradle 中增加 mavenCentral() 这个 Repo 后重新编译一次。

    Bugfix & ChangeLog

    1. Fix: Windows 下编译 Patch 失败。
    2. 修改编译脚本和 POM 信息,以支持发布到 MavenCentral。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.15(Apr 1, 2021)

  • v1.9.14.14(Mar 25, 2021)

  • v1.9.14.13(Mar 17, 2021)

  • v1.9.14.12(Mar 10, 2021)

    Bugfix & ChangeLog

    1. 兼容 AGP 3.x ~ AGP 4.1(HotFix: 1.9.14.11 版本在 AGP 4.1 环境下 MultiDex 主 Dex Keep 规则 Hack 会失败)
    2. 修改反复 crash 后回退策略:修改后只有主进程能触发回退,其他进程在启动时若闪退次数超限,则只标记移除 patch,不直接回退,这样回退操作会延迟到主进程重启,以避免主副进程版本不一致的问题。
    3. 将反射移除字段 final 标志的逻辑改为 Unsafe 直接获取字段值,以支持 JDK 12+ 环境。(感谢 @fengdai )
    4. oldApk 配置为目录的情况下若 newApk 配置的目录中 apk 与 oldApk 配置的目录中的 apk 不匹配(数量、名称不匹配),则报错中断编译。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.11(Mar 8, 2021)

    已知问题

    AGP 4.1 环境下 MultiDex 主 Dex Keep 规则 Hack 会失败,AGP 版本为 4.1 且 minSdkVersion < 21 的项目请先不要接入此版本。

    Bugfix & ChangeLog

    1. 兼容 AGP 3.x ~ AGP 4.1
    2. 修改反复 crash 后回退策略:修改后只有主进程能触发回退,其他进程在启动时若闪退次数超限,则只标记移除 patch,不直接回退,这样回退操作会延迟到主进程重启,以避免主副进程版本不一致的问题。
    3. 将反射移除字段 final 标志的逻辑改为 Unsafe 直接获取字段值,以支持 JDK 12+ 环境。(感谢 @fengdai )
    4. oldApk 配置为目录的情况下若 newApk 配置的目录中 apk 与 oldApk 配置的目录中的 apk 不匹配(数量、名称不匹配),则报错中断编译。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.10(Dec 9, 2020)

    Bugfix & ChangeLog

    1. 解决了编译阶段补丁生成时误判 loader 类被修改的问题。
    2. 解决了 BSDiff 导致 StackOverflow 的问题。
    3. 将 TinkerClassLoader 的父类改成了 PathClassLoader,避免 getClassLoader 时的 ClassCastException。
    4. 编译阶段增加对 manifest 里除了四大组件外其他节点修改的校验,如不允许修改 versionCode 等。
    5. 编译阶段增加对 abi 变化的校验,若新包新增了 abi,编译会被中断。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.9(Oct 20, 2020)

    Bugfix & ChangeLog

    1. 适配AGP3.6.0 mapping.txt和R.txt路径。(感谢 @colton.liang )
    2. 修改useDelegateLastClassLoaderOnAPI29AndAbove开关为useDelegateLastClassLoader,修改后此开关将控制 Android 8.0 及以上的系统是否使用 DelegateLastClassLoader 加载 patch。
    3. 修复 base Context 的 ClassLoader 未替换的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.8(Sep 28, 2020)

    Bugfix & ChangeLog

    1. 修改 applicationid 获取的方式,避免设置 flavors 后 applicationid 不对。(感谢 @liuling07 )
    2. 当新包 dex 数量多于旧包的dex数量时编译补丁时会NPE。
    3. 同步 nop 版本和普通版本间的部分差异。(感谢 @simpleton )
    4. 部分编译环境会生成乱序的 catch block,导致误判新包有修改。
    5. 在 API 29 的机器上尝试一些 hack 操作主动触发 dex2oat。
    6. 在 ApplicationLike 中增加接口适配魅族的夜间模式开关。
    7. 修复 nop 版本启动时可能产生的 NPE 问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.7(May 10, 2020)

    Bugfix & ChangeLog

    1. 彻底消除对 Android Support Library / AndroidX Library 的依赖。
    2. 继续修复 Android Q 上卡顿的问题,理论上此版本加载 patch 后会引入约 800ms ~ 1000ms 的额外开销,暂时没想到好办法规避。
    3. 修复 #1391 中提到的问题。
    4. 修复热修后 SharedLibrary R 类中的资源 ID 与 AssetManager 中 Package ID 不一致导致的资源找不到问题。(多谢 @wanglianbao)
    5. 在给 TinkerLog 设置实现类之前缓存 TinkerLog 打的日志,App 启动后可调用 TinkerLog.printPendingLogs() 将这些日志通过设置的实现类输出。
    6. 修复因魅族机器首次加载 dex 时不生成 oat 导致 patch 加载失败的问题。
    7. 尝试修复 APPLICATION_INFO_CHANGED 事件引起的 ClassLoader 检查异常。
    8. 修复 OTA 之后主副进程状态不一致的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.6(Mar 11, 2020)

    注意:

    如果接入此版本后编译时报如下错误:

    More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'
    

    在 app 工程的 build.gradle 中加入以下内容即可解决问题:

    android {
        packagingOptions {
            exclude 'META-INF/proguard/androidx-annotations.pro'
        }
    }
    

    Bugfix & ChangeLog

    1. 修复漏传 dexOptDir 导致 Android N 上卡顿,以及 ClassLoader Hack 新方案导致的部分 Android Q 机型卡顿的问题。
    2. 使用新方法解决 Android Q 上 Verify Class 导致的卡顿问题,不再引入 parent PathClassLoader,避免部分框架出现问题。( 这样一来 @yuany 的变更就没机会起作用了,不过还是感谢提交 ci 哇)
    3. 修复了华为方舟补丁接口 isArkHotRuning 总是返回 false 的问题。
    4. 修复了 Gradle 6 和 AS 4.0 下的一些兼容性问题。(感谢 @fmoda3 )
    5. Tinker 运行时库改用 androidx 作为 support 库。(感谢 @fmoda3 )
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.5(Dec 13, 2019)

    Bugfix & ChangeLog

    1. 修复 Tinker 在 Android Q 上导致启动和运行卡顿的问题。
    2. 修复已加载 patch 的情况下再次 Apply 一个新 patch 之后马上清除 patch 会导致主进程和其他进程的 patch 版本不一致的问题。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14.3(Oct 16, 2019)

    Bugfix & ChangeLog

    1. 修复 TinkerApplicationInlineFence 类没有被自动 keep 到主 dex 的 bug。
    2. 保护 BindService 提高 patch 进程优先级的逻辑偶尔在 unbind 的时候产生的 crash。
    3. 四字节对齐 patch 中的 dex,避免加载时产生 mmap 放大的问题。
    4. 使用 PathClassLoader 触发合成 patch 后的 dex2oat,避免因 patch 失去 jit 支持导致性能问题。(多谢华为的建议)
    5. 修改 maindex keep 规则,避免主 dex 中引入过多的类。
    Source code(tar.gz)
    Source code(zip)
  • v1.9.14(Aug 30, 2019)

    Bugfix & ChangeLog

    1. 改用Try-catch+特殊方法名隔离Application和ApplicationLike以阻止AOT/JIT内联,避免部分ClassCastException等问题。
    2. 修复补丁在乐固和360加固宝环境下加载失败导致闪退的问题。
    3. 通过BindService提高patch进程优先级,加快补丁合成速度。(感谢 @dodola !)
    4. 继续修复在最新AGP上的部分兼容问题。(感谢 @lizhangqu !)
    5. 增加华为方舟环境补丁支持(作为Tinker的旁路逻辑接入,方舟化补丁的具体使用流程将在华为提交的文档中说明。)
    Source code(tar.gz)
    Source code(zip)
  • v1.9.13.2(Jun 17, 2019)

  • v1.9.13.1(Jun 11, 2019)

    Bugfix & ChangeLog

    1. Fix #1074 ( 感谢 @noproxy !)
    2. Fix Android Q上因为App的默认ClassLoader可能不为PathClassLoader导致补丁加载失败。
    3. Fix #1084 ( 感谢 @noproxy !这里他提供了一个临时方案,即对每个Dex都尝试移除loader pattern中指定的class,并忽略关于loader class变化的警告。切记不要在minSDK < 21的情况下开启此方案!!)
    4. 增加对AGP 3.4+上R8的支持。(感谢 @lizhangqu !)
    5. 暂时回退为使用startService来启动Patch进程,解决部分系统禁用JobScheduler的问题。
    6. Fix #1093
    Source code(tar.gz)
    Source code(zip)
  • v1.9.13(Apr 26, 2019)

    Bugfix & ChangeLog

    • 将Patch Apply的重试次数增加到20;
    • 将Tinker运行时库对support-annotations的依赖改为compileOnly,避免接入时引入整个appcompat包;
    • 修复加固模式下patch无法加载成功的问题;
    • 修复Android P下patch无法加载成功的问题;
    • 修复后台进程在patch加载时偶尔发生ANR的问题(主进程对patch.info的更新改为先做oat再更新);
    • 修复P中因apache类被内联导致的crash;(感谢@lizhangqu)
    • 引入shadowJar插件,彻底解决生成的Tinker CLI工具报ClassNotFound的问题。

    注意,对于主dex中的类数量莫名变大的问题,目前已确定是minSDK=21时AGP启用了native-multidex,导致gradle中配置的maindex list参数被忽略引起的。在找到通用的规避方案之前暂时只能通过给dx附加参数指定main dex class file的方式规避了。

    Source code(tar.gz)
    Source code(zip)
  • v1.9.12(Feb 21, 2019)

    Bugfix:

    Fix了Tinker Build SDK的一些问题:

    • ZipEntry目录穿透漏洞
    • buildTinkerSdk task无法生成完整的jar包

    删除了Tinker Build SDK中的一些无用代码

    Tinker Android Runtime部分没有变更。

    没有对外提供补丁生成服务,只在本地编译环境里使用Tinker的用户请继续等待1.9.13版本。

    Source code(tar.gz)
    Source code(zip)
  • v1.9.11(Jan 11, 2019)

    2019年2月23日 更新:

    JobIntentService在部分机型上并不可靠,导致补丁合成大量失败,最近打算回退这部分变更。使用独立SDK Jar对外提供补丁生成服务的用户请更新代码到1.9.12再运行buildTinkerSdk生成新版本jar修复一个安全漏洞,其他用户请暂时回退到1.9.9,等待1.9.13版本发布。


    Bugfix

    • 引入JobSchedulerService重新实现了TinkerPatchService和TinkerPatchResultService。
    • 修复加固模式下崩溃的问题。
    • Demo和插件的Android Gradle Plugin版本统一改成了3.2.1,gradle version统一改为了4.6。建议App将gradle wrapper配置中的版本也改成4.6或4.7,Android Gradle Plugin版本改为3.2.1。
    • TinkerApplication中对ApplicationLike的反射调用增加了Method缓存,避免性能问题。

    !!注意!!

    • 覆盖率偏低时请检查App中实现TinkerPatchResultService的类在manifest中是否有声明android.permission.BIND_JOB_SERVICE权限。
    Source code(tar.gz)
    Source code(zip)
Owner
Tencent
Tencent
xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.

(English Documents Available) C#下Lua编程支持 xLua为Unity、 .Net、 Mono等C#环境增加Lua脚本编程的能力,借助xLua,这些Lua代码可以方便的和C#相互调用。 xLua的突破 xLua在功能、性能、易用性都有不少突破,这几方面分别最具代表性的

Tencent 8.1k Jan 3, 2023
Fix for HotSpot deep stack problem

Fix for HotSpot deep stack problem Java HotSpot C2 compiler has a problem with deeply recursive functions. For a discussion of the problem see https:/

Roman Elizarov 4 Nov 14, 2022
A hotfix library for Android platform, and not just this...

中文版 wiki (deprecated) changelog Amigo Service Platform (Amigo backend service is no longer supported) Amigo is a hotfix library which can fix everythi

eleme 1.4k Nov 25, 2022
Nuwa, pure java implementation, can hotfix your android application.

Nuwa Nuwa is a goddess in ancient Chinese mythology best known for repairing the pillar of heaven. With this Nuwa project,you can also have the repair

Jason Ross 3k Dec 17, 2022
dexposed enable 'god' mode for single android application.

What is it? Dexposed is a powerful yet non-invasive runtime AOP (Aspect-oriented Programming) framework for Android app development, based on the work

Alibaba 4.5k Dec 28, 2022
Kafka-hot-and-cold-retries - Demo project for elaborating how hot and cold retries can be applied in Kafka

Apache Kafka® - Hot and Cold Retries A demo project for elaborating how hot and

Berat CANKAR 11 Jun 10, 2022
AndFix is a library that offer hot-fix for Android App.

AndFix AndFix is a solution to fix the bugs online instead of redistributing Android App. It is distributed as Android Library. Andfix is an acronym f

Alibaba 6.9k Dec 29, 2022
A tool translate a apk file to stantard android project include so hook api and il2cpp c++ scaffolding when apk is a unity il2cpp game. Write code on a apk file elegantly.

FakerAndroid (FakerAndroid.jar or FakerAndroid-AS) A tool translate a apk file to stantard android project include so hook api and il2cpp c++ scaffold

null 231 Dec 29, 2022
A solution to fix obfuscated Java services after ProGuard has run

ProGuard Service Mapper This is a service mapper for the ProGuard Java bytecode

Marvin 1 Jan 10, 2022
APK Explorer & Editor, an open-source tool to explore the contents of an installed APK

APK Explorer & Editor, an open-source tool to explore the contents of an installed APK, is strictly made with an aim to inspect an installed APK file.

APK Explorer & Editor 270 Dec 25, 2022
A simple utility to remove unused resources in your Android app to lower the size of the APK. It's based on the Android lint tool output.

android-resource-remover android-resource-remover is utility that removes unused resources reported by Android Lint from your project. The goal is to

Keepsafe 1.3k Dec 16, 2022
Location tracking & geofencing the easy way. Supports background, killed app, rebooted device different update intervals.

Geofencer Convience library to receive user location updates and geofence events with minimal effort. Features: supports Android-Q receive updates on

null 85 Dec 15, 2022
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

null 4.3k Jan 2, 2023
ImmutablePendingIntent provides mutability safe methods and quick fix

ImmutablePendingIntent Overview ImmutablePendingIntent provides methods that create immutability-safe PendingIntent lint to make an error when using m

wada811 5 Nov 25, 2022
xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.

(English Documents Available) C#下Lua编程支持 xLua为Unity、 .Net、 Mono等C#环境增加Lua脚本编程的能力,借助xLua,这些Lua代码可以方便的和C#相互调用。 xLua的突破 xLua在功能、性能、易用性都有不少突破,这几方面分别最具代表性的

Tencent 8.1k Jan 3, 2023
Reproducible sample with Fix for Memory Leak in RecyclerView Adapter

Memory Leak RecyclerView Adapter Reproducible Sample with Fix Video Instructions: https://www.youtube.com/c/awesomedevnotes Code Only the relevant and

Awesome Dev Notes | Android Dev Notes YouTube 7 Jun 7, 2022
Fix for HotSpot deep stack problem

Fix for HotSpot deep stack problem Java HotSpot C2 compiler has a problem with deeply recursive functions. For a discussion of the problem see https:/

Roman Elizarov 4 Nov 14, 2022
MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team

MIUI 原生通知图标 Fix the native notification bar icon function abandoned by the MIUI

Fankesyooni 189 Jan 4, 2023
A Android Web IDE supports code auto-completion and highlight, plugin (Supports Html, Css, JS, Json, Php etc)

WebDevOps A Android Web IDE supports code auto-completion and highlight, plugin (Supports Html, Css, JS, Json, Php etc) Join us QQ group number: 10314

SuMuCheng 22 Jan 3, 2023