蚂蚁freeline安装教程以及问题解决

介绍

Freeline是一款针对Android平台的增量编译工具, 项目地址
虽然最新的版本是0.7.3.1,但是这个版本增量编译会bug,推荐用0.7.2

第一步

配置project-level的build.gradle,加入freeline-gradle的依赖:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.antfortune.freeline:gradle:0.7.2'
    }
}


在你的主module的build.gradle中,应用freeline插件的依赖:

apply plugin: 'com.antfortune.freeline'

android {

    freeline {
        hack true
        autoDependency false
        //productFlavor "normal"
    }

}

dependencies {
    debugCompile 'com.antfortune.freeline:runtime:0.7.2'
    releaseCompile 'com.antfortune.freeline:runtime-no-op:0.7.2'
    testCompile 'com.antfortune.freeline:runtime-no-op:0.7.2'
}

切记一定要加入
apply plugin: 'com.antfortune.freeline'

在Application类中的onCreate()函数的最前面调用

// import com.antfortune.freeline.FreelineCore;

FreelineCore.init(this);
super.onCreate();

最后

  • 初始化项目: gradle initFreeline -Pmirror
  • 编译并启动项目 python freeline.py
    强制全量编译项目 python freeline.py -f
遇到的问题


问题1.    问题描述

扫描二维码关注公众号,回复: 4897405 查看本文章

File"/usr/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception

OSError:[Errno 13] Permission denied


解决方案:

chmod +x gradlew

 

问题2.  问题描述

Execution failed fortask ':app:transformClassesWithDexForTempusRelease'.

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException: com.android.dex.DexException: Multipledex files define Lcom/antfortune/freeline/BuildConfig;

解决方案:

在 Application中去掉的import.freeline的package包去掉,重新让系统import;

同时将以前用module中引用的com.antfortune.freeline:runtime去掉,然后重新compile,最后重新build,已经完美解决了










猜你喜欢

转载自blog.csdn.net/sinat_28496853/article/details/53002057