您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

build.gradle 5.6KB

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