1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| ```gradle
flavorDimensions "apptype", "channel"
productFlavors{
develper {
flavorDimensions "apptype"
//配置manifest中变量 android:authorities="${TABLE_A_AUTHORITIES}"
manifestPlaceholders = [TABLE_A_AUTHORITIES: "table_a_authority", TABLE_A_EXPORT: "true"]
}
cooperatorA{
flavorDimensions "apptype"
manifestPlaceholders = [TABLE_A_AUTHORITIES: "table_a_authority", TABLE_A_EXPORT: "true"]
}
Public {
dimension "channel"
}
common {
dimension "channel"
}
}
```
|
1
2
3
4
5
6
7
8
9
10
| ```java
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.xxxx";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 201912281;
public static final String VERSION_NAME = "2.16";
}
```
|
1
2
3
4
5
6
7
| ``` java
public class RcsUtils {
public static boolean isCooperatorA() {
return TextUtils.equals(BuildConfig.FLAVOR_apptype, "flavorDimensions");
}
}
```
|
1
2
3
4
5
6
7
| ``` gradle
dependencies {
# ....
develperCompile "com.android.support:appcompat-v7:25.1.1"
cooperatorACompile "com.android.support:support-v4:25.1.1"
}
``` ### Manifest中配置不同的渠道值
|
1
2
3
| ``` gradle
android:authorities="${TABLE_A_AUTHORITIES}"
android:exported="${TABLE_A_EXPORT}" ```
|