apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' apply plugin: 'org.jetbrains.kotlin.plugin.compose' android { namespace = "com.liketrek.trek" compileSdk = rootProject.ext.compileSdkVersion defaultConfig { applicationId "com.liketrek.trek" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion // The release workflow (.github/workflows/native-release.yml) passes both: // the version from client/package.json and a build number that only grows. // Local and PR builds fall back to these placeholders. versionCode((project.findProperty('trekVersionCode') ?: '1') as Integer) versionName(project.findProperty('trekVersionName') ?: '0.0.0-dev') testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61 ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } // The upload key only exists in the release workflow, which decodes it from a // secret and passes its path and passwords as Gradle properties. Every other // build (local, fork, PR) stays unsigned and needs no secret. signingConfigs { release { if (project.hasProperty('trekKeystore')) { storeFile file(project.property('trekKeystore')) storePassword project.property('trekKeystorePassword') keyAlias project.property('trekKeyAlias') keyPassword project.property('trekKeyPassword') } } } // java.time in the widgets and the travel-day notification, back to Android 7. compileOptions { coreLibraryDesugaringEnabled true } buildFeatures { compose = true buildConfig = true } // The app's languages, for the system's per-app language setting (Android 13+): // generated from the values-* folders, so a language added there is offered too. androidResources { generateLocaleConfig = true } testOptions { unitTests { includeAndroidResources = true returnDefaultValues = true } } buildTypes { release { if (project.hasProperty('trekKeystore')) { signingConfig signingConfigs.release } minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } repositories { flatDir{ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion" implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion" implementation "androidx.browser:browser:$androidxBrowserVersion" implementation "androidx.biometric:biometric:1.1.0" implementation "androidx.core:core-ktx:$androidxCoreVersion" coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5" // Home-screen widgets. implementation "androidx.glance:glance-appwidget:$glanceVersion" implementation "androidx.glance:glance-material3:$glanceVersion" // The share sheet and the widget's trip picker. implementation platform("androidx.compose:compose-bom:$composeBomVersion") implementation "androidx.compose.material3:material3" implementation "androidx.compose.material:material-icons-extended" implementation "androidx.compose.ui:ui-tooling-preview" debugImplementation "androidx.compose.ui:ui-tooling" implementation "androidx.activity:activity-compose:$androidxActivityVersion" // A foldable's posture and hinge, and the window's size, for the UI. implementation "androidx.window:window:1.4.0" // Ranks the trip shortcuts in the share sheet on Android 10 and earlier. implementation "androidx.sharetarget:sharetarget:1.2.0" // TREK Cloud subscriptions through Google Play, the counterpart of StoreKit. implementation "com.android.billingclient:billing:$playBillingVersion" // Push through liketrek's relay. No google-services plugin: Firebase reads // its project from res/values/firebase.xml, the strings the plugin would generate. implementation "com.google.firebase:firebase-messaging:24.1.2" implementation project(':capacitor-android') testImplementation "junit:junit:$junitVersion" testImplementation "org.json:json:20250517" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') } apply from: 'capacitor.build.gradle' kotlin { compilerOptions { jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21 } }