1、在项目的build.gradle中添加
buildscript { repositories { jcenter() } dependencies { ... classpath 'com.antfortune.freeline:gradle:0.8.6' } }2、在项目主module的build.gradle中添加
apply plugin: 'com.antfortune.freeline' android { ... freeline { hack true } } 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' }3、在Applincation中的oncreate添加
@Override public void onCreate() { super.onCreate(); FreelineCore.init(this); }
4、下载Python(2.7+,貌似不支持3.0以上版本),配置Python环境变量
5、初始化
· 打开命令行,进入到项目根目录
· gradlew.bat initFreeline,如果中途下载卡住,可以使用gradlew initFreeline -Pmirror
· 需要完整编译一次项目,然后可以增量编译
增量编译 python freeline.py
重新编译整个项目 python freeline.py -f
AndroidStudio可以下载Freeline插件
安装插件可以使用
原理相关:https://yq.aliyun.com/articles/59122
同类插件:JRebel