Skip to content

Commit 8791135

Browse files
authored
Merge pull request #2156 from RoboSats/update-android-architecture-versioning-strategy
Update android architecture versioning strategy
2 parents f60afeb + bbe7fbb commit 8791135

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/android-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ on:
1717
required: true
1818
push:
1919
branches: [ "main" ]
20-
paths: [ "mobile", "frontend" ]
20+
paths: [ "android", "frontend" ]
2121
pull_request:
2222
branches: [ "main" ]
23-
paths: [ "mobile", "frontend" ]
23+
paths: [ "android", "frontend" ]
2424

2525
jobs:
2626
build-android:

android/app/build.gradle.kts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import com.android.build.api.dsl.Packaging
22

3+
val baseVersionCode = 81
4+
35
plugins {
46
alias(libs.plugins.android.application)
57
alias(libs.plugins.kotlin.android)
@@ -13,7 +15,7 @@ android {
1315
applicationId = "com.robosats"
1416
minSdk = 26
1517
targetSdk = 36
16-
versionCode = 15
18+
versionCode = baseVersionCode
1719
versionName = "0.8.1-alpha"
1820

1921
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -65,6 +67,24 @@ android {
6567
}
6668
}
6769

70+
// Configure unique version codes for ABI splits to prevent downgrade issues
71+
androidComponents {
72+
onVariants { variant ->
73+
val abiCodes = mapOf(
74+
"armeabi-v7a" to 1,
75+
"arm64-v8a" to 2,
76+
"x86" to 3,
77+
"x86_64" to 4
78+
)
79+
80+
variant.outputs.forEach { output ->
81+
val abiName = output.filters.find { it.filterType.name == "ABI" }?.identifier
82+
val abiVersionCode = abiCodes[abiName] ?: 0 // Universal APK gets 0
83+
output.versionCode.set(baseVersionCode * 1000 + abiVersionCode)
84+
}
85+
}
86+
}
87+
6888
dependencies {
6989
implementation(libs.androidx.core.ktx)
7090
implementation(libs.androidx.appcompat)

0 commit comments

Comments
 (0)