Skip to content

Commit c60dc5b

Browse files
committed
chore(docs): update LO example readme
Added release APK installation steps
1 parent 420b3ef commit c60dc5b

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

examples/README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add your Ably key to the `local.properties` file:
1919
```properties
2020
sdk.dir=/path/to/android/sdk
2121

22-
ABLY_KEY=xxxx:yyyyyy
22+
EXAMPLES_ABLY_KEY=xxxx:yyyyyy
2323
```
2424

2525
## Steps to Run the App
@@ -66,6 +66,41 @@ The app opens with two tabs:
6666

6767
To see the real-time synchronization in action, run the app on multiple devices or emulators with the same Ably key.
6868

69+
## Building release APK
70+
71+
This is useful to check ProGuard rules, app size, etc.
72+
73+
1. Create signing keys for the Android app
74+
75+
```shell
76+
keytool -genkey -v -keystore release.keystore \
77+
-storepass <store-password> \
78+
-alias <key-alias> \
79+
-keypass <key-password> \
80+
-keyalg RSA -keysize 2048 -validity 25000 -dname "CN=Ably Example App,OU=Examples,O=Ably,L=London,ST=England,C=GB"
81+
```
82+
83+
2. Update `local.properties` file:
84+
85+
```properties
86+
RELEASE_STORE_FILE=/absolute/path/to/release.keystore
87+
RELEASE_STORE_PASSWORD=<store-password>
88+
RELEASE_KEY_ALIAS=<key-alias>
89+
RELEASE_KEY_PASSWORD=<key-password>
90+
```
91+
92+
3. Build release APK
93+
94+
```shell
95+
./gradlew :examples:assembleRelease
96+
```
97+
98+
4. Install to the device
99+
100+
```shell
101+
adb install -r examples/build/outputs/apk/release/examples-release.apk
102+
```
103+
69104
## Troubleshooting
70105

71106
- SDK Not Found: Install missing SDK versions from File > Settings > Appearance & Behavior > System Settings > Android SDK.

examples/build.gradle.kts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,25 @@ android {
2121

2222
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2323

24-
buildConfigField("String", "ABLY_KEY", "\"${getLocalProperty("ABLY_KEY") ?: ""}\"")
24+
buildConfigField("String", "ABLY_KEY", "\"${getLocalProperty("EXAMPLES_ABLY_KEY") ?: ""}\"")
2525
}
2626

2727
buildTypes {
2828
release {
29-
isMinifyEnabled = false
29+
isMinifyEnabled = true
30+
isShrinkResources = true
31+
3032
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
33+
34+
val keystorePath = getLocalProperty("EXAMPLES_STORE_FILE")
35+
keystorePath?.let {
36+
signingConfig = signingConfigs.create("release") {
37+
keyAlias = getLocalProperty("EXAMPLES_KEY_ALIAS")
38+
keyPassword = getLocalProperty("EXAMPLES_KEY_PASSWORD")
39+
storeFile = file(it)
40+
storePassword = getLocalProperty("EXAMPLES_STORE_PASSWORD")
41+
}
42+
}
3143
}
3244
}
3345
compileOptions {

0 commit comments

Comments
 (0)