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

本文详细介绍如何在Android项目中引入并配置Freeline热更新工具,包括Gradle配置步骤、Python环境设置及初始化过程,帮助开发者实现代码的快速增量编译。

3426

被折叠的 条评论
为什么被折叠?



