Table of Contents

Android Freeline

Freeline is an open source solution to speed up your compiling, like 2 seconds compared to 2 minutes in the old way. It's super fast because of the increment build only for the changed class.

How to Integrate

1. Add to the build.gradle in the root directory of your project

 buildscript {
     dependencies {
         classpath 'com.android.tools.build:gradle:2.2.2'
         classpath 'com.google.gms:google-services:1.4.0-beta3'
 
         //Freeline
         classpath 'com.antfortune.freeline:gradle:0.8.2'
     }

2. Add to the app/build.gradle

//Freeline
apply plugin: 'com.antfortune.freeline'

android {
     ...
     freeline {
         hack true
         productFlavor 'flavorA'
     }
 
     productFlavors {
        flavorA {}
     }
     ...
}

How to Use

When you are the first time to run it

./gradlew initFreeline

Then enjoy it

python freeline.py
python freeline.py -d //with debug information logs

Force Clean Build

Also try the force clean build if it doesn't work

python freeline.py -f//If you need the force clean build.

Questions&Tips

  1. When you clean the cache of the App, you need to do the clean build
  2. When you files changed a lot, you also need to do the clean build
  3. When you switch between different branches, you may need to do the clean build
  4. You can add alias to your .bashrc or .zshrc if you like
    • alias freeline='python freeline.py'
  5. If you don't want to commit the changes, you can use the patch command to do it
    • Create the patch: git diff > freeline.patch
    • Apply the patch: patch -p1 < freeline.patch
    • Revert the patch: patch -p1 -R <freeline.patch
    • Or use git stash and git stash pop to reset or apply the patch temporary