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

文章介绍了如何配置和使用Freeline——一个Android增量编译工具,特别提到了0.7.2版本的稳定性。在使用过程中遇到的两个问题:1)Permissiondenied错误,解决方案是修改gradlew文件权限;2)Multipledexfiles冲突,解决方法是删除多余import并重新构建项目。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

介绍
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.    问题描述

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,已经完美解决了
————————————————
版权声明:本文为优快云博主「sinat_28496853」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/sinat_28496853/article/details/53002057

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值