v0.1.0 crashed on every start: R8's full mode (AGP 9) took Room 2.6.1's
`-keep class * extends RoomDatabase` to keep no constructor, and WorkManager
creates its database by reflection (NoSuchMethodException
WorkDatabase_Impl.<init>). Checking the Loop's firmware failed too: Polar's
SDK asks through Retrofit 2.9.0, whose rules predate the full mode, and
Retrofit lost the generic signatures of its suspend functions ("Class cannot
be cast to ParameterizedType").
Train's own proguard-rules.pro keeps the database's constructor, adds
Retrofit 2.11's three rules and keeps the firmware service's requests and
replies, which Gson fills. Debug builds don't shrink, so neither showed
before the release; checked on a Pixel 9a with a release build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
106 lines
4.4 KiB
Kotlin
106 lines
4.4 KiB
Kotlin
plugins {
|
|
id("com.android.application")
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
}
|
|
|
|
android {
|
|
namespace = "app.halkyon.train"
|
|
compileSdk = flutter.compileSdkVersion
|
|
ndkVersion = flutter.ndkVersion
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "app.halkyon.train"
|
|
// You can update the following values to match your application needs.
|
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
|
// Android 8: Health Connect's client needs it (ADR 0030, D31).
|
|
minSdk = 26
|
|
targetSdk = flutter.targetSdkVersion
|
|
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
|
|
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
|
|
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
|
|
// flag during build.
|
|
versionCode = flutter.versionCode
|
|
versionName = flutter.versionName
|
|
}
|
|
|
|
// The app's own key signs release builds when tool/release.dart hands it over
|
|
// through the environment, as Learn's does: the keystore's path and the key's
|
|
// alias, and the password asked for at each release, never written down. Other
|
|
// release builds are signed with the debug key, so `flutter run --release` works
|
|
// anywhere; the release tool releases no APK signed otherwise.
|
|
val releaseKeystore = System.getenv("HALKYON_ANDROID_KEYSTORE")
|
|
signingConfigs {
|
|
if (releaseKeystore != null) {
|
|
create("release") {
|
|
storeFile = file(releaseKeystore)
|
|
keyAlias = System.getenv("HALKYON_ANDROID_KEY_ALIAS")
|
|
// A PKCS #12 keystore has one password, for the store and its key.
|
|
storePassword = System.getenv("HALKYON_ANDROID_KEYSTORE_PASSWORD")
|
|
keyPassword = System.getenv("HALKYON_ANDROID_KEYSTORE_PASSWORD")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
signingConfig =
|
|
signingConfigs.findByName("release") ?: signingConfigs.getByName("debug")
|
|
// Train's keep rules for R8, beside the libraries' and Flutter's.
|
|
proguardFiles("proguard-rules.pro")
|
|
}
|
|
}
|
|
|
|
// The native libraries go into the APK compressed, as Learn's: one APK serves
|
|
// every phone, holding them for three architectures, and Android unpacks the
|
|
// phone's own as it installs the app.
|
|
packaging {
|
|
jniLibs {
|
|
useLegacyPackaging = true
|
|
}
|
|
}
|
|
|
|
// Leaves out the list of dependencies Gradle would otherwise add to the APK,
|
|
// encrypted for Google Play alone; F-Droid's and others' scanners flag it.
|
|
dependenciesInfo {
|
|
includeInApk = false
|
|
includeInBundle = false
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source = "../.."
|
|
}
|
|
|
|
dependencies {
|
|
// NotificationCompat and ServiceCompat for the recording's foreground service,
|
|
// the version Learn's build uses.
|
|
implementation("androidx.core:core:1.18.0")
|
|
// Health Connect (ADR 0030, D30, D31): AndroidX's client, no Play services.
|
|
implementation("androidx.health.connect:connect-client:1.1.0")
|
|
// The Polar Loop (ADR 0030, D32, D34): Polar's BLE SDK, under Polar's licence.
|
|
implementation("com.github.polarofficial:polar-ble-sdk:8.3.0")
|
|
// The protobuf runtime the SDK brings at run time, at its version, to read
|
|
// the training sessions it gives as Polar's messages (ADR 0030, D39).
|
|
compileOnly("com.google.protobuf:protobuf-javalite:3.20.0")
|
|
testImplementation("com.google.protobuf:protobuf-javalite:3.20.0")
|
|
// The Loop read every few hours while Train is closed (ADR 0030, D37).
|
|
implementation("androidx.work:work-runtime-ktx:2.10.1")
|
|
// Music by cadence in the recording service (ADR 0030, D47, D48): Media3's
|
|
// ExoPlayer, its speed changed with the pitch kept; pinned by its checksums
|
|
// in gradle/verification-metadata.xml.
|
|
implementation("androidx.media3:media3-exoplayer:1.10.1")
|
|
// The recorder's pure Kotlin parts (auto-pause) tested on the JVM.
|
|
testImplementation("junit:junit:4.13.2")
|
|
}
|