Skip to content

Commit c98eb76

Browse files
authored
chore: add Kotlin DSL instructions to Android flavors guide (#437)
* chore: add Kotlin DSL instructions to Android flavors guide * format
1 parent 7bc4743 commit c98eb76

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

src/content/docs/code-push/guides/flavors/android.mdx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar:
66
order: 21
77
---
88

9+
import { Tabs, TabItem } from '@astrojs/starlight/components';
10+
911
This guide will walk through how to setup an app in which there are 2 deployment
1012
flavors: `internal` and `stable`. It will cover how to validate a patch on the
1113
internal flavor and then promote the patch to the stable flavor on Android.
@@ -30,7 +32,40 @@ Create a new project using `flutter create flavors`.
3032

3133
## Configure Flavors
3234

33-
Next, edit the `android/app/build.gradle` to contain two productFlavors:
35+
<Tabs>
36+
37+
<TabItem value="kotlin" label="Kotlin DSL">
38+
39+
Next edit the `android/app/build.gradle.kts` to contain two productFlavors:
40+
41+
```diff
42+
defaultConfig {
43+
...
44+
}
45+
46+
+ flavorDimensions += "track"
47+
+ productFlavors {
48+
+ create("internal") {
49+
+ dimension = "track"
50+
+ applicationIdSuffix = ".internal"
51+
+ manifestPlaceholders["applicationLabel"] = "[Internal] Shorebird Example"
52+
+ }
53+
+ create("stable") {
54+
+ dimension = "track"
55+
+ manifestPlaceholders["applicationLabel"] = "Shorebird Example"
56+
+ }
57+
+ }
58+
59+
buildTypes {
60+
...
61+
}
62+
```
63+
64+
</TabItem>
65+
66+
<TabItem value="groovy" label="Groovy DSL">
67+
68+
Next edit the `android/app/build.gradle` to contain two productFlavors:
3469

3570
```diff
3671
defaultConfig {
@@ -55,6 +90,9 @@ buildTypes {
5590
}
5691
```
5792

93+
</TabItem>
94+
</Tabs>
95+
5896
Lastly, edit `android/app/src/main/AndroidManifest.xml` to use the
5997
`applicationLabel` so that we can differentiate the two apps easily:
6098

0 commit comments

Comments
 (0)