apply plugin: 'com.android.application' apply plugin: 'org.jetbrains.kotlin.android' def appVersion = new groovy.json.JsonSlurper().parse(file("../../package.json")).version def appVersionParts = appVersion.tokenize('.').collect { it.toInteger() } def releaseStoreFile = System.getenv('EP_MAIL_ANDROID_STORE_FILE') def releaseStorePassword = System.getenv('EP_MAIL_ANDROID_STORE_PASSWORD') def releaseKeyAlias = System.getenv('EP_MAIL_ANDROID_KEY_ALIAS') def releaseKeyPassword = System.getenv('EP_MAIL_ANDROID_KEY_PASSWORD') def releaseSigningValues = [releaseStoreFile, releaseStorePassword, releaseKeyAlias, releaseKeyPassword] def hasAnyReleaseSigningValue = releaseSigningValues.any { it != null && !it.isBlank() } def hasCompleteReleaseSigning = releaseSigningValues.every { it != null && !it.isBlank() } if (hasAnyReleaseSigningValue && !hasCompleteReleaseSigning) { throw new GradleException('Android release signing requires EP_MAIL_ANDROID_STORE_FILE, EP_MAIL_ANDROID_STORE_PASSWORD, EP_MAIL_ANDROID_KEY_ALIAS, and EP_MAIL_ANDROID_KEY_PASSWORD.') } if (hasCompleteReleaseSigning && !new File(releaseStoreFile).isAbsolute()) { throw new GradleException('EP_MAIL_ANDROID_STORE_FILE must be an absolute path.') } android { namespace = "studio.daybreak.mail" compileSdk = rootProject.ext.compileSdkVersion buildFeatures { buildConfig true } if (hasCompleteReleaseSigning) { signingConfigs { release { storeFile file(releaseStoreFile) storePassword releaseStorePassword keyAlias releaseKeyAlias keyPassword releaseKeyPassword } } } packaging { resources { pickFirsts += "META-INF/NOTICE.md" pickFirsts += "META-INF/LICENSE.md" } } defaultConfig { applicationId "studio.daybreak.mail" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode appVersionParts[0] * 10000 + appVersionParts[1] * 100 + appVersionParts[2] versionName appVersion 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:!*~' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' if (hasCompleteReleaseSigning) signingConfig signingConfigs.release } } compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } kotlinOptions { jvmTarget = '21' } } 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 project(':capacitor-android') implementation 'com.sun.mail:android-mail:1.6.7' implementation 'com.sun.mail:android-activation:1.6.7' implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation 'androidx.work:work-runtime-ktx:2.10.1' testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') } apply from: 'capacitor.build.gradle' try { def servicesJSON = file('google-services.json') if (servicesJSON.text) { apply plugin: 'com.google.gms.google-services' } } catch(Exception e) { logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") }