1 plugins {
2 id 'com.android.application'
3 id 'com.google.gms.google-services'
4 }
5
6 def keystorePropertiesFile = rootProject.file('local.properties')
7 def keystoreProperties = new Properties()
8 if (keystorePropertiesFile.exists()) {
9 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
10 }
11
12 android {
13 compileSdk 34
14 namespace "com.jcrguidepro.app"
15
16 defaultConfig {
17 applicationId "com.jcrguidepro.app"
18 minSdk 21
19 targetSdk 34
20 versionCode 1
21 versionName "1.0.0"
22 }
23
24 signingConfigs {
25 release {
26 if (keystoreProperties.containsKey('release.keystore')) {
27 storeFile file(keystoreProperties['release.keystore'])
28 storePassword keystoreProperties['release.keystore.password']
29 keyAlias keystoreProperties['release.key.alias']
30 keyPassword keystoreProperties['release.key.password']
31 }
32 }
33 }
34
35 buildTypes {
36 debug {
37 applicationIdSuffix ".debug"
38 debuggable true
39 }
40 release {
41 minifyEnabled true
42 shrinkResources true
43 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
44 if (keystoreProperties.containsKey('release.keystore')) {
45 signingConfig signingConfigs.release
46 }
47 }
48 }
49
50 compileOptions {
51 sourceCompatibility JavaVersion.VERSION_11
52 targetCompatibility JavaVersion.VERSION_11
53 }
54
55 lint {
56 disable "BidiSpoofing"
57 }
58 }
59
60 // Automatically copy web assets into the Android project and fix paths
61 tasks.register('copyWebAssets', Copy) {
62 from "../../dist/public"
63 into "src/main/assets/www"
64 duplicatesStrategy = DuplicatesStrategy.INCLUDE
65
66 // Fix absolute paths in index.html to be relative and remove Replit banner
67 filter { line ->
68 line.replaceAll('src="/assets/', 'src="./assets/')
69 .replaceAll('href="/assets/', 'href="./assets/')
70 .replaceAll('src="/manifest.json"', 'src="./manifest.json"')
71 .replaceAll('href="/manifest.json"', 'href="./manifest.json"')
72 .replaceAll('href="/icon-', 'href="./icon-')
73 .replaceAll('src="/icon-', 'src="./icon-')
74 .replaceAll('<script type="text/javascript" src="https://replit.com/public/js/replit-dev-banner.js"></script>', '')
75 }
76 }
77
78 // Make sure assets are copied before building the APK
79 preBuild.dependsOn copyWebAssets
80
81 dependencies {
82 implementation 'androidx.appcompat:appcompat:1.6.1'
83 implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
84 implementation 'androidx.webkit:webkit:1.11.0'
85
86 // Firebase
87 implementation platform('com.google.firebase:firebase-bom:33.14.0')
88 implementation 'com.google.firebase:firebase-analytics'
89 }