Skip to content

Commit f6a6096

Browse files
committed
使用AAF独立开发
1 parent 9151c1d commit f6a6096

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

sample/customize.md

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
## 概述
2+
3+
这部分内容主要介绍,如何基于 AAF 的整体框架,进行新应用的开发。由于**AAF 对于Android的构建方式做了一定范围的重构与定制。**为了更贴近实际开发的场景,这里提供两种开发模式的使用事例:
4+
5+
- 基于 AAF 构建模式
6+
7+
- 基于通用Android项目构建模式
8+
9+
两种使用方法是一致的,只是配置会有细微差距。所有事例都基于[AndroidAppFactory-Sample](https://github.com/bihe0832/AndroidAppFactory-Sample) 来介绍
10+
11+
## 基于 AAF 构建模式
12+
13+
- 新建空目录
14+
15+
```shell
16+
mkdir ./
17+
```
18+
19+
20+
- 复制 AndroidAppFactory-Sample 的所有内容到当前目录
21+
22+
```shell
23+
cp -fr ~/zixie/github/AndroidAppFactory-Sample/ ./
24+
```
25+
26+
- 删除除 APPTest 和 Application 以外的所有模块(也就是所有Base 开头和Pub 开头的项目)及 Git 信息
27+
28+
```shell
29+
ls | grep Base | xargs -I {} rm -fr ./{}
30+
ls | grep Pub | xargs -I {} rm -fr ./{}
31+
rm -fr .git
32+
rm -fr demo
33+
```
34+
35+
- 修改 dependencies.gradle
36+
37+
修改dependencies.gradle,仅保留 APPTest 和 Application 的配置
38+
39+
- ext.moduleInfo 仅保留 APPTest 和 Application的配置
40+
41+
- ext.mainProject = "APPTest"
42+
43+
- ext.developModule = "Application"
44+
45+
修改后的dependencies.gradle 如下:
46+
47+
```java
48+
apply from: rootDir.toString() + '/config.gradle'
49+
def project = ext
50+
51+
ext.mainProject = "APPTest"
52+
ext.developModule = "Application"
53+
ext.pubModuleIsApplication = true
54+
ext.includeALLDependOnDevelopModule = false
55+
ext.moduleVersionName = "3.6.5"
56+
ext.moduleInfo = [
57+
58+
"APPTest" : [
59+
"apidependenciesList": ["",
60+
"com.bihe0832.android:common-test:${project.aaf_version}",
61+
"Application"
62+
]
63+
],
64+
"Application" : [
65+
"apidependenciesList" : [
66+
"com.bihe0832.android:common-feedback:${project.aaf_version}",
67+
"com.bihe0832.android:common-photos:${project.aaf_version}",
68+
"com.bihe0832.android:common-splash:${project.aaf_version}",
69+
"com.bihe0832.android:framework:${project.aaf_version}",
70+
'com.squareup.okhttp3:okhttp:3.9.1',
71+
'com.squareup.okhttp3:logging-interceptor:3.8.0',
72+
'com.squareup.retrofit2:retrofit:2.4.0',
73+
'com.squareup.retrofit2:converter-gson:2.4.0',
74+
"org.jetbrains.kotlin:kotlin-stdlib:${project.kotlin_version}"
75+
76+
],
77+
"specialdependenciesList": [
78+
"kapt": ["com.bihe0832.android:lib-router-compiler:${project.aaf_router_version}"]
79+
]
80+
]
81+
]
82+
```
83+
84+
- 运行项目
85+
86+
运行APPTest
87+
88+
## 基于通用Android项目构建模式
89+
90+
- 新建 Android 工程,已有可以跳过
91+
92+
- 将 APPTest 和 Application 复制到项目根目录
93+
94+
- 在项目根目录`settings.gradle`添加APPTest 和 Application ,例如:
95+
96+
```java
97+
include ':Application'
98+
include ':APPTest'
99+
```
100+
101+
- 在 Application 的 `build.gradle` 中添加依赖:
102+
103+
```java
104+
dependencies {
105+
api "com.bihe0832.android:common-feedback:${project.aaf_version}"
106+
api "com.bihe0832.android:common-photos:${project.aaf_version}"
107+
api "com.bihe0832.android:common-splash:${project.aaf_version}"
108+
api "com.bihe0832.android:common-test:${project.aaf_version}"
109+
api "com.bihe0832.android:framework:${project.aaf_version}"
110+
111+
api "com.squareup.okhttp3:okhttp:3.9.1"
112+
api "com.squareup.okhttp3:logging-interceptor:3.8.0"
113+
api "com.squareup.retrofit2:retrofit:2.4.0"
114+
api "com.squareup.retrofit2:converter-gson:2.4.0"
115+
}
116+
```
117+
118+
- 在 APPTest 的 `build.gradle` 中添加依赖:
119+
120+
```java
121+
dependencies {
122+
api project(':Application')
123+
}
124+
```
125+
126+
- 运行APPTest

0 commit comments

Comments
 (0)