You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. apply plugin: 'com.android.application'
  2. // Crashlytics integration is done as part of Firebase now, so it gets
  3. // automagically activated with google-services.json
  4. if (googleServicesEnabled) {
  5. apply plugin: 'com.google.firebase.crashlytics'
  6. }
  7. // Use the number of seconds/10 since Jan 1 2019 as the versionCode.
  8. // This lets us upload a new build at most every 10 seconds for the
  9. // next ~680 years.
  10. // https://stackoverflow.com/a/38643838
  11. def vcode = (int) (((new Date().getTime() / 1000) - 1546297200) / 10)
  12. android {
  13. compileSdkVersion rootProject.ext.compileSdkVersion
  14. buildToolsVersion rootProject.ext.buildToolsVersion
  15. packagingOptions {
  16. exclude 'lib/*/libhermes*.so'
  17. }
  18. defaultConfig {
  19. applicationId 'org.jitsi.meet'
  20. versionCode vcode
  21. versionName project.appVersion
  22. minSdkVersion rootProject.ext.minSdkVersion
  23. targetSdkVersion rootProject.ext.targetSdkVersion
  24. ndk {
  25. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  26. }
  27. }
  28. signingConfigs {
  29. debug {
  30. storeFile file('debug.keystore')
  31. storePassword 'android'
  32. keyAlias 'androiddebugkey'
  33. keyPassword 'android'
  34. }
  35. }
  36. buildTypes {
  37. debug {
  38. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  39. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  40. }
  41. release {
  42. // Uncomment the following line for singing a test release build.
  43. //signingConfig signingConfigs.debug
  44. minifyEnabled true
  45. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
  46. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  47. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  48. }
  49. }
  50. sourceSets {
  51. main {
  52. java {
  53. if (rootProject.ext.libreBuild) {
  54. srcDir "src"
  55. exclude "**/GoogleServicesHelper.java"
  56. }
  57. }
  58. }
  59. }
  60. compileOptions {
  61. sourceCompatibility JavaVersion.VERSION_1_8
  62. targetCompatibility JavaVersion.VERSION_1_8
  63. }
  64. }
  65. dependencies {
  66. implementation fileTree(dir: 'libs', include: ['*.jar'])
  67. implementation 'androidx.appcompat:appcompat:1.4.1'
  68. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
  69. if (!rootProject.ext.libreBuild) {
  70. implementation 'com.google.android.gms:play-services-auth:16.0.1'
  71. // Firebase
  72. // - Crashlytics
  73. // - Dynamic Links
  74. implementation 'com.google.firebase:firebase-analytics:17.5.0'
  75. implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
  76. implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
  77. }
  78. implementation project(':sdk')
  79. }
  80. gradle.projectsEvaluated {
  81. // Dropbox integration
  82. //
  83. def dropboxAppKey
  84. if (project.file('dropbox.key').exists()) {
  85. dropboxAppKey = project.file('dropbox.key').text.trim() - 'db-'
  86. }
  87. if (dropboxAppKey) {
  88. android.defaultConfig.resValue('string', 'dropbox_app_key', "${dropboxAppKey}")
  89. def dropboxActivity = """
  90. <activity
  91. android:configChanges="keyboard|orientation"
  92. android:exported="true"
  93. android:launchMode="singleTask"
  94. android:name="com.dropbox.core.android.AuthActivity">
  95. <intent-filter>
  96. <action android:name="android.intent.action.VIEW" />
  97. <category android:name="android.intent.category.BROWSABLE" />
  98. <category android:name="android.intent.category.DEFAULT" />
  99. <data android:scheme="db-${dropboxAppKey}" />
  100. </intent-filter>
  101. </activity>"""
  102. android.applicationVariants.all { variant ->
  103. variant.outputs.each { output ->
  104. output.getProcessManifestProvider().get().doLast {
  105. def outputDir = multiApkManifestOutputDirectory.get().asFile
  106. def manifestPath = new File(outputDir, 'AndroidManifest.xml')
  107. def charset = 'UTF-8'
  108. def text
  109. text = manifestPath.getText(charset)
  110. text = text.replace('</application>', "${dropboxActivity}</application>")
  111. manifestPath.write(text, charset)
  112. }
  113. }
  114. }
  115. }
  116. // Run React packager
  117. android.applicationVariants.all { variant ->
  118. def targetName = variant.name.capitalize()
  119. def currentRunPackagerTask = tasks.create(
  120. name: "run${targetName}ReactPackager",
  121. type: Exec) {
  122. group = "react"
  123. description = "Run the React packager."
  124. doFirst {
  125. println "Starting the React packager..."
  126. def androidRoot = file("${projectDir}/../")
  127. // Set up the call to the script
  128. workingDir androidRoot
  129. // Run the packager
  130. commandLine("scripts/run-packager.sh")
  131. }
  132. // Set up dev mode
  133. def devEnabled = !targetName.toLowerCase().contains("release")
  134. // Only enable for dev builds
  135. enabled devEnabled
  136. }
  137. def packageTask = variant.packageApplicationProvider.get()
  138. packageTask.dependsOn(currentRunPackagerTask)
  139. }
  140. }
  141. if (googleServicesEnabled) {
  142. apply plugin: 'com.google.gms.google-services'
  143. }