diff options
| author | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
|---|---|---|
| committer | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
| commit | 449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch) | |
| tree | c131c3528c4d517f56e19b854a7453fedb097d40 /android/app/build.gradle | |
| download | aves-src-master.tar.gz aves-src-master.zip | |
Diffstat (limited to 'android/app/build.gradle')
| -rw-r--r-- | android/app/build.gradle | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..6afa8ea --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,220 @@ +plugins { + id 'com.android.application' + id 'com.google.devtools.ksp' + id 'kotlin-android' + id 'dev.flutter.flutter-gradle-plugin' +} + +def packageName = "deckers.thibault.aves" + +// Keys + +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + // for release using credentials stored in a local file + keystorePropertiesFile.withReader('UTF-8') { reader -> keystoreProperties.load(reader) + } +} else { + // for release using credentials in environment variables set up by GitHub Actions + // warning: in property file, single quotes should be escaped with a backslash + // but they should not be escaped when stored in env variables + keystoreProperties["storeFile"] = System.getenv("AVES_STORE_FILE") ?: "<NONE>" + keystoreProperties["storePassword"] = System.getenv("AVES_STORE_PASSWORD") ?: "<NONE>" + keystoreProperties["keyAlias"] = System.getenv("AVES_KEY_ALIAS") ?: "<NONE>" + keystoreProperties["keyPassword"] = System.getenv("AVES_KEY_PASSWORD") ?: "<NONE>" + keystoreProperties["googleApiKey"] = System.getenv("AVES_GOOGLE_API_KEY") ?: "<NONE>" +} + +kotlin { + jvmToolchain 17 +} + +android { + namespace = 'deckers.thibault.aves' + compileSdk = 36 + + compileOptions { + // enable support for the new language APIs on older devices + // e.g. `java/util/function/Supplier` on Android 5.0 (API 21) + coreLibraryDesugaringEnabled = true + // should match `kotlin.jvmToolchain` + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + applicationId = packageName + minSdk = flutter.minSdkVersion + targetSdk = 36 + versionCode = flutter.versionCode + versionName = flutter.versionName + manifestPlaceholders = [googleApiKey: keystoreProperties["googleApiKey"] ?: "<NONE>"] + multiDexEnabled = true + } + + signingConfigs { + release { + keyAlias keystoreProperties["keyAlias"] + keyPassword keystoreProperties["keyPassword"] + storeFile keystoreProperties["storeFile"] ? file(keystoreProperties["storeFile"]) : null + storePassword keystoreProperties["storePassword"] + } + } + + flavorDimensions += "store" + + productFlavors { + play { + // Google Play + dimension "store" + // generate a universal APK without x86 native libs + ext.useNdkAbiFilters = true + } + + izzy { + // IzzyOnDroid + // check offending libraries with `scanapk` + // cf https://android.izzysoft.de/articles/named/app-modules-2 + dimension "store" + // generate APK by ABI, but NDK ABI filters are incompatible with split APK generation + ext.useNdkAbiFilters = false + } + + libre { + // F-Droid + // check offending libraries with `fdroidserver` + // cf https://f-droid.org/en/docs/Submitting_to_F-Droid_Quick_Start_Guide/ + dimension "store" + // generate APK by ABI, but NDK ABI filters are incompatible with split APK generation + ext.useNdkAbiFilters = false + applicationIdSuffix ".libre" + } + + libre_rom { + // integration in custom ROM + dimension "store" + // generate a universal APK without x86 native libs + ext.useNdkAbiFilters = true + applicationIdSuffix ".libre" + + packagingOptions { + // disable compression for native libraries (.so files) + jniLibs.useLegacyPackaging false + } + } + } + + buildTypes { + debug { + applicationIdSuffix ".debug" + } + profile { + applicationIdSuffix ".profile" + } + release { + signingConfig = signingConfigs.release + minifyEnabled = true + shrinkResources = true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + + applicationVariants.all { variant -> + variant.resValue 'string', 'screen_saver_settings_activity', "${applicationId}/${packageName}.ScreenSaverSettingsActivity" + variant.resValue 'string', 'search_provider', "${applicationId}.search_provider" + + variant.outputs.each { output -> + def baseAbiVersionCode = rootProject.ext.abiCodes.get(output.getFilter('ABI')) + if (baseAbiVersionCode != null) { + output.versionCodeOverride = variant.versionCode * 100 + baseAbiVersionCode + } + } + } + + android.productFlavors.each { flavor -> + def tasks = gradle.startParameter.taskNames.toString().toLowerCase() + if (tasks.contains(flavor.name) && flavor.ext.useNdkAbiFilters) { + release { + // specify architectures, to specifically exclude native libs for x86, + // which lead to: UnsatisfiedLinkError...couldn't find "libflutter.so" + // cf https://github.com/flutter/flutter/issues/37566#issuecomment-640879500 + ndk { + //noinspection ChromeOsAbiSupport + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' + } + } + } + } + } +} + +flutter { + source '../..' +} + +repositories { + maven { + url = 'https://jitpack.io' + content { + includeGroup "com.github.deckerst" + includeGroup "com.github.deckerst.mp4parser" + } + } + maven { + url = 'https://s3.amazonaws.com/repo.commonsware.com' + content { + excludeGroupByRegex "com\\.github\\.deckerst.*" + } + } +} + +dependencies { + // cf https://developer.android.com/studio/write/java8-support#library-desugaring + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") + + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2' + + implementation 'androidx.annotation:annotation:1.9.1' + implementation "androidx.appcompat:appcompat:1.7.1" + implementation 'androidx.core:core-ktx:1.17.0' + // `lifecycle-process:2.10.0` requires `minSdkVersion` 23+ + implementation 'androidx.lifecycle:lifecycle-process:2.9.4' + implementation 'androidx.media:media:1.7.1' + implementation 'androidx.multidex:multidex:2.0.1' + // Jetpack `security-crypto` library is deprecated: + // https://developer.android.com/privacy-and-security/cryptography#security-crypto-jetpack-deprecated + implementation 'androidx.security:security-crypto:1.1.0' + // `work-runtime:2.11.0` requires `minSdkVersion` 23+ + implementation 'androidx.work:work-runtime:2.10.5' + + implementation 'com.commonsware.cwac:document:0.5.0' + implementation 'com.drewnoakes:metadata-extractor:2.19.0' + implementation "com.github.bumptech.glide:glide:$glide_version" + implementation 'com.google.android.material:material:1.13.0' + // SLF4J implementation for `mp4parser` + implementation 'org.slf4j:slf4j-simple:2.0.17' + + // forked, built by JitPack: + // - https://jitpack.io/p/deckerst/Android-TiffBitmapFactory + // - https://jitpack.io/p/deckerst/androidsvg + // - https://jitpack.io/p/deckerst/mp4parser + // - https://jitpack.io/p/deckerst/pixymeta-android + implementation 'com.github.deckerst:Android-TiffBitmapFactory:424b18a4ae' + implementation 'com.github.deckerst:androidsvg:c7e58e8e59' + implementation 'com.github.deckerst.mp4parser:isoparser:c2898f1832' + implementation 'com.github.deckerst.mp4parser:muxer:c2898f1832' + implementation 'com.github.deckerst:pixymeta-android:f4513291b7' + implementation project(':exifinterface') + + testImplementation 'org.junit.jupiter:junit-jupiter-engine:6.0.1' + + ksp "com.github.bumptech.glide:ksp:$glide_version" + + compileOnly rootProject.findProject(':streams_channel') +} + +if (useCrashlytics) { + println("Building flavor with Crashlytics plugin") + apply plugin: 'com.google.gms.google-services' + apply plugin: 'com.google.firebase.crashlytics' +} |
