zourb / tinker

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tinker

license

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall 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.6.0')
    }
}

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

dependencies {
    //optional, help to gen the final application 
    compile('com.tencent.tinker:tinker-android-anno:1.6.0')
    //tinker's main Android lib
    compile('com.tencent.tinker:tinker-android-lib:1.6.0') 
}
...
...
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, which will be 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 as follows:

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.SampleApplicationLike");
    }  
}

Use tinker-android-anno to generate your Application is more recommended, you can just 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 change the proguard config automatic, and also generate the multiDex keep proguard file for you.

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

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.

About

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

License:Other


Languages

Language:Java 96.7%Language:Groovy 3.2%Language:IDL 0.0%Language:Shell 0.0%