build.gradle.kts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import java.util.Properties
  2. plugins {
  3. id("com.android.application")
  4. id("org.jetbrains.kotlin.android")
  5. id("rust")
  6. {{~#each android-app-plugins}}
  7. id("{{this}}"){{/each}}
  8. }
  9. val tauriProperties = Properties().apply {
  10. val propFile = file("tauri.properties")
  11. if (propFile.exists()) {
  12. propFile.inputStream().use { load(it) }
  13. }
  14. }
  15. android {
  16. compileSdk = 34
  17. namespace = "{{app.identifier}}"
  18. defaultConfig {
  19. manifestPlaceholders["usesCleartextTraffic"] = "false"
  20. applicationId = "{{app.identifier}}"
  21. minSdk = {{android.min-sdk-version}}
  22. targetSdk = 34
  23. versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
  24. versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
  25. }
  26. buildTypes {
  27. getByName("debug") {
  28. manifestPlaceholders["usesCleartextTraffic"] = "true"
  29. isDebuggable = true
  30. isJniDebuggable = true
  31. isMinifyEnabled = false
  32. packaging {
  33. {{~#each abi-list}}
  34. jniLibs.keepDebugSymbols.add("*/{{this}}/*.so")
  35. {{/each}}
  36. }
  37. }
  38. getByName("release") {
  39. isMinifyEnabled = true
  40. proguardFiles(
  41. *fileTree(".") { include("**/*.pro") }
  42. .plus(getDefaultProguardFile("proguard-android-optimize.txt"))
  43. .toList().toTypedArray()
  44. )
  45. }
  46. }
  47. kotlinOptions {
  48. jvmTarget = "1.8"
  49. }
  50. buildFeatures {
  51. buildConfig = true
  52. }
  53. }
  54. rust {
  55. rootDirRel = "{{root-dir-rel}}"
  56. }
  57. dependencies {
  58. {{~#each android-app-dependencies-platform}}
  59. implementation(platform("{{this}}")){{/each}}
  60. {{~#each android-app-dependencies}}
  61. implementation("{{this}}"){{/each}}
  62. implementation("androidx.webkit:webkit:1.6.1")
  63. implementation("androidx.appcompat:appcompat:1.6.1")
  64. implementation("com.google.android.material:material:1.8.0")
  65. testImplementation("junit:junit:4.13.2")
  66. androidTestImplementation("androidx.test.ext:junit:1.1.4")
  67. androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
  68. }
  69. apply(from = "tauri.build.gradle.kts")