Colota - Android GPS Location tracker
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '../..'
root = file("../../")
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
reactNativeDir = file("../../../../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
codegenDir = file("../../../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
cliFile = file("../../../../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
debuggableVariants = ["gmsDebug", "fossDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
def osName = System.getProperty('os.name').toLowerCase()
def osBin = osName.contains('win') ? 'win64-bin' : osName.contains('mac') ? 'osx-bin' : 'linux64-bin'
def hermescExe = osName.contains('win') ? 'hermesc.exe' : 'hermesc'
hermesCommand = ["node", "--print", "require.resolve('hermes-compiler/hermesc/${osBin}/${hermescExe}')"].execute(null, rootDir).text.trim()
// hermesFlags = ["-O", "-output-source-map"]
/* Autolinking */
autolinkLibrariesWithApp()
}
/**
* Set this to true to run Proguard on Release builds.
* It minifies bytecode, reduces app size, and makes reverse-engineering harder.
*/
def enableProguardInReleaseBuilds = true
// Use project.findProperty to safely check for the variable
def isHermesEnabled = project.findProperty('hermesEnabled') == 'true'
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
android {
ndkVersion = rootProject.ext.ndkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion
dependenciesInfo {
// Disables dependency metadata when building APKs (for IzzyOnDroid/F-Droid)
includeInApk = false
// Disables dependency metadata when building Android App Bundles (for Google Play)
includeInBundle = false
}
namespace = "com.Colota"
defaultConfig {
applicationId "com.Colota"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 54
versionName "1.21.1"
// Strip Build IDs for reproducible builds (IzzyOnDroid/F-Droid)
externalNativeBuild {
cmake {
arguments "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--build-id=none"
}
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (
project.hasProperty('MYAPP_UPLOAD_STORE_FILE') &&
project.hasProperty('MYAPP_UPLOAD_STORE_PASSWORD') &&
project.hasProperty('MYAPP_UPLOAD_KEY_ALIAS') &&
project.hasProperty('MYAPP_UPLOAD_KEY_PASSWORD')
) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
} else {
// Fallback: No signing config available
// This will cause release builds to fail, which is expected
println "⚠️ WARNING: No release signing configuration found!"
println " For local builds: Set up gradle.properties"
println " For CI builds: Set GitHub Secrets"
}
}
}
buildTypes {
debug {
signingConfig = signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig = signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
shrinkResources = false // Disabled for reproducible builds
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
flavorDimensions "distribution"
productFlavors {
gms {
dimension "distribution"
// Google Play Services variant
}
foss {
dimension "distribution"
// F-Droid / open-source variant — no Google Play Services
}
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
splits {
abi {
reset()
// Disable ABI splits for bundle tasks (AABs handle this natively)
// Keep this form: the F-Droid recipe turns splits off with sed 's/enable !gradle.*/enable false/'
enable !gradle.startParameter.taskNames.any { it.toLowerCase().contains("bundle") }
universalApk = false
include "arm64-v8a", "armeabi-v7a", "x86_64", "x86"
}
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.includeAndroidResources = true
unitTests.all {
// Bump heap to avoid OOM when running the full test suite.
maxHeapSize = "4g"
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
gmsImplementation 'com.google.android.gms:play-services-location:21.4.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0'
implementation 'androidx.security:security-crypto:1.1.0'
implementation 'org.bouncycastle:bcprov-jdk18on:1.86'
implementation 'androidx.car.app:app:1.7.0'
implementation 'androidx.work:work-runtime:2.12.0'
implementation 'androidx.documentfile:documentfile:1.1.0'
if (isHermesEnabled) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
testImplementation 'junit:junit:4.13.2'
testImplementation 'io.mockk:mockk:1.14.11'
testImplementation 'org.json:json:20251224'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0'
testImplementation 'org.robolectric:robolectric:4.17'
testImplementation 'androidx.test:core:1.7.0'
testImplementation 'androidx.work:work-testing:2.12.0'
}