1.在项目的build.gradle中添加
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.antfortune.freeline:gradle:0.6.3'
}
}
2.在项目主module的build.gradle中添加
apply plugin: 'com.antfortune.freeline'
android{
...
freeline {
hack true
}
}
dependencies{
...
debugCompile 'com.antfortune.freeline:runtime:0.6.3'
releaseCompile 'com.antfortune.freeline:runtime-no-op:0.6.3'
testCompile 'com.antfortune.freeline:runtime-no-op:0.6.3'
}
3.在Applincation中的oncreate添加
FreelineCore.init(this);
4.下载python(2.7+,貌似不支持3.0以上版本)
5.使用方法
a.打开命令行,进入到项目根目录
b.gradlew.bat initFreeline,如果中途下载卡住,可以使用gradlew initFreeline -Pmirror
c.python freeline.py,之后修改过文件也需要执行python freeline.py编译,如果需要重新编译整个项目,可以python freeline.py -f
ps:
a.已知freeline与android-build-tools 1.3.2不兼容,所以最好使用较高版本
b.项目路径和sdk,jdk路径中不要出现中文
c.如果项目启用了混淆,需要先把混淆关闭掉
freeline原理链接:https://yq.aliyun.com/articles/59122