Correction bug, modernisation
This commit is contained in:
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example.boidelov3;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import com.example.boidelov3.BuildConfig;
|
||||
|
||||
import com.impossibl.postgres.api.jdbc.PGConnection;
|
||||
|
||||
@@ -9,9 +10,9 @@ import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class DatabaseConnection extends AsyncTask<Void, Void, PGConnection> {
|
||||
private static final String DB_URL = "jdbc:postgresql://82.65.214.214:5432/boidelo";
|
||||
private static final String USER = "Tux2543";
|
||||
private static final String PASSWORD = "6wa*teCnuxsG#grAc5HzC!Rh%#@c&";
|
||||
private static final String DB_URL = BuildConfig.DB_URL;
|
||||
private static final String USER = BuildConfig.DB_USER;
|
||||
private static final String PASSWORD = BuildConfig.DB_PASSWORD;
|
||||
|
||||
@Override
|
||||
protected PGConnection doInBackground(Void... params) {
|
||||
|
||||
Reference in New Issue
Block a user