Correction bug, modernisation

This commit is contained in:
2025-12-31 11:50:30 +01:00
parent 9501053984
commit c5772eef95
3 changed files with 25 additions and 3 deletions
+15
View File
@@ -2,9 +2,19 @@ plugins {
id 'com.android.application'
}
// Load local.properties
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withInputStream { localProperties.load(it) }
}
android {
namespace 'com.example.boidelov3'
compileSdk 33
buildFeatures {
buildConfig = true
}
packagingOptions { resources.excludes.add("META-INF/*") } // This line is added to avoid the error: Duplicate files copied in APK META-INF/LICENSE.txt
defaultConfig {
applicationId "com.example.boidelov3"
@@ -14,6 +24,11 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Inject database credentials into BuildConfig
buildConfigField "String", "DB_URL", "\"${localProperties.getProperty('db.url', '')}\""
buildConfigField "String", "DB_USER", "\"${localProperties.getProperty('db.user', '')}\""
buildConfigField "String", "DB_PASSWORD", "\"${localProperties.getProperty('db.password', '')}\""
}
buildTypes {