What’s Freeline?

Freeline is a compilation scheme based on dynamic replacement customized by ant Jubao team, a one-stop financial management platform under Ant Financial Services, on the Android platform in October 2015. In May, it was opened in Alibaba Group. In terms of stability, it has perfect baseline alignment and process-level abnormal isolation mechanism. Performance: Internally adopt the idea of multi-project, multi-task and concurrency similar to Facebook’s open source tool Buck: Port scanning, code scanning, concurrent compilation, concurrent DX, concurrent merge DEX and other strategies have obvious acceleration effects on multi-core machines. In addition, corresponding cache strategies are made at the level of class, DEX and resources to achieve real incremental development. In addition, part of the acceleration component DX of Buck is introduced and optimized. DexMerger, in terms of resource compilation, deeply transforms Aapt resource compilation process. When resources change, incremental package compilation can be completed at the second level, in which the incremental package only contains the smallest change set (within 10Kb ~ hundreds of Kb), and it can also be used for dynamic resource/code replacement online in the later stage. Several times faster than the current schemes such as Instant-run, Buck and Layoutcast.

Project address: github.com/alibaba/fre…

Using the tutorial

  • Configure project – build. Gradle:
buildscript { repositories { jcenter() }
    dependencies {
        classpath 'com. Antfortune. Freeline: gradle: 0.8.6'
    }
}Copy the code

The module ‘s build. Gradle:

apply plugin: 'com.antfortune.freeline'Copy the code

Note: The above configuration is only append, do not remove gradle related.

dependencies {
  debugCompile 'com. Antfortune. Freeline: runtime: 0.8.6'
  releaseCompile 'com. Antfortune. Freeline: runtime - no - op: 0.8.6'
  testCompile 'com. Antfortune. Freeline: runtime - no - op: 0.8.6'} android {... freeline { hacktrue
      productFlavor "znds"
      autoDependency false}}Copy the code
  • Plug-in installation

    Install the Freeline Plugin in Studio. Toolbar after installation, as shown in figure:

  • Embed code in Application:

public void onCreate() {
    FreelineCore.init(this);    
    super.onCreate(); ... }Copy the code

After that, the project is ready to run.