Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

tinker

> 编程语言
Open source

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

17.7K stars0 likes2 views
WebsiteGitHub

About

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

Tinker

中文说明

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

Getting started

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

gradle
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.

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:

java
-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:

java
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

java
@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:

buildconfig
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.

xml
<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.

gradle
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.

Issues· 571 open

View all issuesOpen on GitHub
  • #1803

    SIGSEGV(SEGV_MAPERR) 报错

    Updated Jul 27, 2026
  • #1802

    使用Hilt注解了原MainApplication 打完补丁包报错must be attached to an @HiltAndroidApp Application

    Updated May 22, 2026
  • #1786

    Android 16 AGP4.1.1 日志提示安装成功但加载失败

    Updated Apr 15, 2026
  • #1207

    Tinker1.9.14,使用了360加固,补丁加载成功后重启crash

    bugUpdated Mar 31, 2026
  • #1771

    生成补丁包时出现 ArrayIndexOutOfBoundsException

    Updated Mar 30, 2026
  • #1752

    agp8.x,isProtectedApp=true情况下生成热修复包失败

    Updated Mar 30, 2026
  • #1218

    乐固加固并签名后,patch下载成功,重启后,patch不生效!!

    Updated Mar 30, 2026
  • #1777

    热修复后,调用Application类中的public方法会crash

    Updated Mar 27, 2026
  • #1764

    Application集成问题

    Updated Jan 21, 2026
  • #1656

    Android11+小米手机上TinkerDexOptimizer.triggerPMDexOptOnDemand执行结果异常

    Updated Jan 2, 2026

> Tags

Javaandroiddynamichotfixwechat

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言