You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
358 lines
14 KiB
Kotlin
358 lines
14 KiB
Kotlin
import java.util.Properties
|
|
import java.io.FileInputStream
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("kotlin-android")
|
|
id("com.google.gms.google-services") version "4.4.1" // Add the version here
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
id("com.huawei.agconnect")
|
|
id("kotlin-parcelize")
|
|
// id("com.mapbox.gradle.application")
|
|
// id("com.mapbox.gradle.plugins.ndk")
|
|
}
|
|
|
|
val keystoreProperties = Properties()
|
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
|
if (keystorePropertiesFile.exists()) {
|
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
|
}
|
|
|
|
android {
|
|
namespace = "com.cloudsolutions.HMGPatientApp"
|
|
compileSdk = 36
|
|
// Using NDK 26 for better compatibility with Zoom SDK native libraries
|
|
// ndkVersion = "27.0.12077973"
|
|
ndkVersion = "28.2.13676358"
|
|
// ndkVersion = "25.1.8937393"
|
|
|
|
sourceSets {
|
|
getByName("main") {
|
|
jniLibs.srcDirs("src/main/jniLibs")
|
|
}
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "com.cloudsolutions.HMGPatientApp"
|
|
// minSdk = 24
|
|
minSdk = 29
|
|
targetSdk = 35
|
|
compileSdk = 36
|
|
// targetSdk = flutter.targetSdkVersion
|
|
versionCode = flutter.versionCode
|
|
versionName = flutter.versionName
|
|
multiDexEnabled = true
|
|
|
|
// Force application label to override plugin labels
|
|
manifestPlaceholders["appLabel"] = "Dr. Alhabib"
|
|
resValue("string", "app_name", "Dr. Alhabib")
|
|
resValue("string", "application_name", "Dr. Alhabib")
|
|
|
|
// Filter to arm64-v8a for better native library compatibility
|
|
ndk {
|
|
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
|
|
}
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
dataBinding = true
|
|
}
|
|
|
|
sourceSets {
|
|
// getByName("main") {
|
|
// java.srcDirs += "src/main/kotlin"
|
|
// jniLibs.srcDir("src/main/libs")
|
|
// jni.srcDirs = listOf() // disables automatic ndk-build
|
|
// }
|
|
getByName("main") {
|
|
java.srcDir("src/main/kotlin")
|
|
jniLibs.srcDir("src/main/libs")
|
|
// To disable automatic ndk-build, do not set jni.srcDirs
|
|
// If you need to clear jni.srcDirs:
|
|
// set("jni.srcDirs", emptyList<String>())
|
|
}
|
|
}
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
keyPassword = keystoreProperties.getProperty("keyPassword")
|
|
storeFile = keystoreProperties.getProperty("storeFile")?.let { file(it) }
|
|
storePassword = keystoreProperties.getProperty("storePassword")
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
getByName("debug") {
|
|
isDebuggable = true
|
|
signingConfig = signingConfigs.getByName("debug")
|
|
isMinifyEnabled = false
|
|
isShrinkResources = false
|
|
}
|
|
getByName("release") {
|
|
isDebuggable = false
|
|
signingConfig = signingConfigs.getByName("release")
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
}
|
|
create("staging") {
|
|
matchingFallbacks += listOf("debug", "qa", "release")
|
|
}
|
|
}
|
|
|
|
packaging {
|
|
jniLibs {
|
|
pickFirsts += listOf(
|
|
"lib/x86/libc++_shared.so",
|
|
"lib/x86_64/libc++_shared.so",
|
|
"lib/armeabi-v7a/libc++_shared.so",
|
|
"lib/arm64-v8a/libc++_shared.so",
|
|
"**/*.so"
|
|
)
|
|
// useLegacyPackaging = true
|
|
useLegacyPackaging = false
|
|
// Keep Zoom SDK libraries unstripped to preserve symbols
|
|
keepDebugSymbols += listOf(
|
|
"*/libzoom_util.so",
|
|
"*/libzoom_check.so",
|
|
"*/libc++_shared.so"
|
|
)
|
|
}
|
|
resources {
|
|
excludes += listOf("META-INF/proguard/androidx-annotations.pro")
|
|
excludes.add("lib/*/libc++_shared.so")
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
isCoreLibraryDesugaringEnabled = true
|
|
}
|
|
|
|
// kotlinOptions {
|
|
// jvmTarget = "17"
|
|
// }
|
|
|
|
lint {
|
|
disable += "MissingTranslation"
|
|
checkReleaseBuilds = false
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source = "../.."
|
|
}
|
|
|
|
dependencies {
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.20")
|
|
implementation("com.google.firebase:firebase-messaging:24.1.2")
|
|
implementation("pub.devrel:easypermissions:3.0.0")
|
|
implementation("com.google.guava:guava:33.4.0-android")
|
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"), "exclude" to listOf("bcprov-jdk16-1.46.jar"))))
|
|
implementation("com.google.code.gson:gson:2.12.0")
|
|
|
|
// Zoom SDKs
|
|
// implementation("us.zoom.videosdk:zoomvideosdk-core:1.12.10")
|
|
// implementation("us.zoom.videosdk:zoomvideosdk-annotation:1.12.10")
|
|
// implementation("us.zoom.videosdk:zoomvideosdk-videoeffects:1.12.10")
|
|
|
|
implementation("us.zoom.videosdk:zoomvideosdk-core:2.1.10")
|
|
implementation("us.zoom.videosdk:zoomvideosdk-videoeffects:2.1.10")
|
|
implementation("us.zoom.videosdk:zoomvideosdk-annotation:2.1.10")
|
|
|
|
// Networking
|
|
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11")
|
|
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
|
|
implementation("com.squareup.retrofit2:retrofit:2.11.0")
|
|
implementation("com.squareup.retrofit2:converter-gson:2.11.0")
|
|
implementation("com.squareup.retrofit2:adapter-java8:2.11.0")
|
|
|
|
// Google Services
|
|
implementation("com.google.android.gms:play-services-location:21.3.0")
|
|
implementation("com.google.android.gms:play-services-basement:18.7.0")
|
|
|
|
implementation("com.android.volley:volley:1.2.1")
|
|
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
|
|
implementation("androidx.navigation:navigation-fragment-ktx:2.9.0")
|
|
implementation("androidx.navigation:navigation-ui-ktx:2.9.0")
|
|
implementation("androidx.activity:activity-ktx:1.10.1")
|
|
|
|
val room_version = "2.6.1"
|
|
implementation("androidx.room:room-runtime:$room_version")
|
|
annotationProcessor("androidx.room:room-compiler:$room_version")
|
|
|
|
// implementation("net.zetetic:android-database-sqlcipher:4.6.1")
|
|
implementation("net.zetetic:sqlcipher-android:4.6.1@aar")
|
|
implementation("com.intuit.ssp:ssp-android:1.1.0")
|
|
implementation("com.intuit.sdp:sdp-android:1.1.0")
|
|
|
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
|
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
|
|
|
|
// implementation("com.mapbox.maps:android:11.5.0")
|
|
implementation("com.mapbox.maps:android-ndk27:11.22.0")
|
|
implementation("com.mapbox.mapboxsdk:mapbox-sdk-turf:7.3.1")
|
|
// implementation("com.mapbox.maps:android:11.4.0")
|
|
|
|
// AARs
|
|
implementation(files("libs/PenNavUI.aar"))
|
|
implementation(files("libs/Penguin.aar"))
|
|
implementation(files("libs/PenguinRenderer.aar"))
|
|
api(files("libs/samsung-health-data-api.aar"))
|
|
implementation("com.huawei.hms:health:6.11.0.300")
|
|
implementation("com.huawei.hms:hmscoreinstaller:6.6.0.300")
|
|
|
|
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
|
|
implementation("com.github.kittinunf.fuel:fuel-android:2.3.1")
|
|
|
|
// implementation("com.opentok.android:opentok-android-sdk:2.25.2")
|
|
|
|
// implementation("com.facebook.stetho:stetho:1.6.0")
|
|
// implementation("com.facebook.stetho:stetho-urlconnection:1.6.0")
|
|
|
|
implementation("androidx.core:core-ktx:1.16.0")
|
|
implementation("androidx.appcompat:appcompat:1.7.1")
|
|
implementation("com.google.android.material:material:1.12.0")
|
|
|
|
implementation("pl.droidsonroids.gif:android-gif-drawable:1.2.29")
|
|
implementation("com.mapbox.mapboxsdk:mapbox-sdk-turf:7.3.1")
|
|
|
|
androidTestImplementation("androidx.test:core:1.6.1")
|
|
implementation("com.whatsapp.otp:whatsapp-otp-android-sdk:0.1.0")
|
|
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
|
|
// implementation(project(":vitalSignEngine"))
|
|
}
|
|
|
|
tasks.whenTaskAdded {
|
|
if (name.contains("merge") && name.contains("NativeLibs")) {
|
|
doLast {
|
|
val outputDir = File(project.buildDir, "intermediates/merged_native_libs/release/out/lib")
|
|
|
|
// Handle both architectures
|
|
val abis = listOf("arm64-v8a", "armeabi-v7a")
|
|
abis.forEach { abi ->
|
|
val targetFile = File(outputDir, "$abi/libc++_shared.so")
|
|
val sourceFile = file("src/main/jniLibs/$abi/libc++_shared.so")
|
|
|
|
if (sourceFile.exists() && targetFile.exists()) {
|
|
println("FORCING: Overwriting $abi version with known-good 1.2MB library")
|
|
sourceFile.copyTo(targetFile, overwrite = true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// DISABLED: This was causing packaging conflicts
|
|
// Instead relying on manifest merger rules and resource priorities
|
|
/*
|
|
// CRITICAL: Fix CallKit plugin conflict at compile time
|
|
tasks.register("fixCallKitPluginConflict") {
|
|
doLast {
|
|
println("🔧 Fixing CallKit plugin conflicts with payment services...")
|
|
|
|
// Fix merged manifests
|
|
val manifestFiles = listOf(
|
|
File(project.layout.buildDirectory.asFile.get(), "intermediates/merged_manifests"),
|
|
File(project.layout.buildDirectory.asFile.get(), "intermediates/packaged_manifests")
|
|
)
|
|
|
|
manifestFiles.forEach { manifestDir ->
|
|
if (manifestDir.exists()) {
|
|
manifestDir.walkTopDown().forEach { file ->
|
|
if (file.isFile && file.name == "AndroidManifest.xml") {
|
|
var content = file.readText()
|
|
var modified = false
|
|
|
|
// Remove any CallKit application labels
|
|
if (content.contains("android:label=\"CallKit\"")) {
|
|
content = content.replace("android:label=\"CallKit\"", "android:label=\"@string/app_name\"")
|
|
modified = true
|
|
println(" ✓ Removed CallKit label from: ${file.path}")
|
|
}
|
|
|
|
// Ensure tools namespace is declared if we need to use it
|
|
if (content.contains("<manifest") && !content.contains("xmlns:tools")) {
|
|
content = content.replace(
|
|
"<manifest",
|
|
"<manifest xmlns:tools=\"http://schemas.android.com/tools\""
|
|
)
|
|
modified = true
|
|
}
|
|
|
|
// Ensure our app label takes precedence - only if tools namespace exists
|
|
if (content.contains("<application") && content.contains("xmlns:tools") && !content.contains("tools:replace=\"android:label\"")) {
|
|
content = content.replace(
|
|
"<application",
|
|
"<application tools:replace=\"android:label\""
|
|
)
|
|
modified = true
|
|
}
|
|
|
|
if (modified) {
|
|
file.writeText(content)
|
|
println(" ✓ Patched manifest: ${file.path}")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Fix merged resources (strings.xml)
|
|
val resFiles = listOf(
|
|
File(project.layout.buildDirectory.asFile.get(), "intermediates/merged_res"),
|
|
File(project.layout.buildDirectory.asFile.get(), "intermediates/incremental/mergeDebugResources/merged.dir"),
|
|
File(project.layout.buildDirectory.asFile.get(), "intermediates/incremental/mergeReleaseResources/merged.dir")
|
|
)
|
|
|
|
resFiles.forEach { resDir ->
|
|
if (resDir.exists()) {
|
|
resDir.walkTopDown().forEach { file ->
|
|
if (file.isFile && file.name == "strings.xml") {
|
|
var content = file.readText()
|
|
var modified = false
|
|
|
|
// Replace any "CallKit" string resources
|
|
if (content.contains(">CallKit<")) {
|
|
content = content.replace(">CallKit<", ">Dr. Alhabib<")
|
|
modified = true
|
|
println(" ✓ Replaced CallKit string in: ${file.path}")
|
|
}
|
|
|
|
if (modified) {
|
|
file.writeText(content)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
println("✅ CallKit plugin conflict fix completed!")
|
|
}
|
|
}
|
|
|
|
// Run the fix after manifest and resource merging
|
|
tasks.whenTaskAdded {
|
|
if (name.contains("merge") && (name.contains("Manifest") || name.contains("Resources"))) {
|
|
finalizedBy("fixCallKitPluginConflict")
|
|
}
|
|
}
|
|
*/
|
|
|
|
//tasks.whenTaskAdded {
|
|
// if (name.contains("merge") && name.contains("NativeLibs")) {
|
|
// doLast {
|
|
// val outputDir = File(project.buildDir, "intermediates/merged_native_libs/release/out/lib")
|
|
// val targetFile = File(outputDir, "arm64-v8a/libc++_shared.so")
|
|
// val sourceFile = file("src/main/jniLibs/arm64-v8a/libc++_shared.so")
|
|
//
|
|
// if (sourceFile.exists()) {
|
|
// println("FORCE REPLACING: Injecting 1.2MB libc++ into APK...")
|
|
// sourceFile.copyTo(targetFile, overwrite = true)
|
|
// }
|
|
// }
|
|
// }
|
|
//} |