CircleToSearch with multi search engine support for all android
Kotlin
/*
*
* * Copyright (C) 2025 AKS-Labs (original author)
* *
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
android {
namespace = "com.akslabs.circletosearch"
compileSdk {
version = release(36)
}
signingConfigs {
create("release") {
val ksFile = System.getenv("KEYSTORE_FILE")
if (ksFile != null) {
storeFile = file(ksFile)
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
} else {
// Local fallback: sign with the standard debug keystore so a
// plain `assembleRelease` still produces an installable APK
// for size/perf validation. CI overrides via KEYSTORE_* env.
val debugKeystore =
file("${System.getProperty("user.home")}/.android/debug.keystore")
if (debugKeystore.exists()) {
storeFile = debugKeystore
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
}
}
}
defaultConfig {
applicationId = "com.akslabs.circletosearch"
minSdk = 29
targetSdk = 36
versionCode = 7
versionName = "0.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
androidResources {
localeFilters += "en"
}
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs
.getByName("release")
.takeIf { it.storeFile?.exists() == true }
}
getByName("debug") {
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
splits {
abi {
isEnable = true
reset()
include("arm64-v8a", "armeabi-v7a")
isUniversalApk = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
// Fixed dependenciesInfo block
dependenciesInfo {
@Suppress("UnstableApiUsage")
includeInApk = false
@Suppress("UnstableApiUsage")
includeInBundle = false
}
buildFeatures {
compose = true
}
packaging {
jniLibs {
// Keep native libs compressed in the APK (smaller download);
// matches android:extractNativeLibs="true" in the manifest.
useLegacyPackaging = true
}
resources {
// Debug-agent probe bytes bundled inside kotlinx-coroutines-core;
// never loaded in production (only by kotlinx-coroutines-debug).
excludes += "DebugProbesKt.bin"
}
}
}
// ABI-specific version codes for F-Droid and multi-APK support
// arm64-v8a gets a higher code than armeabi-v7a so it's prioritized on compatible devices
androidComponents {
onVariants { variant ->
val abiCodes = mapOf("armeabi-v7a" to 1, "arm64-v8a" to 2)
variant.outputs.forEach { output ->
val abi = output.filters.find {
it.filterType == com.android.build.api.variant.FilterConfiguration.FilterType.ABI
}?.identifier
if (abi != null) {
val baseCode = android.defaultConfig.versionCode ?: 0
output.versionCode.set(baseCode * 10 + (abiCodes[abi] ?: 0))
}
}
}
}
dependencies {
implementation(project(":OCR-translation"))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.webkit:webkit:1.9.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.zxing:core:3.5.4")
}