对于android studio一个工程
Freeline 初始化环境:
根目录下的 build.gradle(工程级别的build.gradle文件)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.antfortune.freeline:gradle:0.8.7'
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
项目下面的 build.gradle(Module级别的build.gradle文件)
apply plugin: 'com.antfortune.freeline'
android {
...
freeline {
hack true
}
}
dependencies {
compile 'com.antfortune.freeline:runtime:0.8.7'
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
自定义的 Application
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
FreelineCore.init(this);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
执行完这些步骤以后,接下在命令行(或者AS的终端)中执行以下命令:
Windows: gradlew.bat initFreeline -PfreelineVersion=0.8.7
Linux/Mac:gradlew initFreeline -PfreelineVersion=0.8.7
然后在as中安装freeline插件:
至此,Freeline已经成功的集成到了我们的项目中,如果觉得每次执行命令行比较繁琐,可以在AS中安装Freeline的插件。
File->Settings->plugins->搜索Freeline即可
然后每次运行直接点击freeline那个按钮就可以了