Application Android et IOS pour l'amicale des élèves
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 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. apply plugin: "com.android.application"
  2. import com.android.build.OutputFile
  3. /**
  4. * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
  5. * and bundleReleaseJsAndAssets).
  6. * These basically call `react-native bundle` with the correct arguments during the Android build
  7. * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
  8. * bundle directly from the development server. Below you can see all the possible configurations
  9. * and their defaults. If you decide to add a configuration block, make sure to add it before the
  10. * `apply from: "../../node_modules/react-native/react.gradle"` line.
  11. *
  12. * project.ext.react = [
  13. * // the name of the generated asset file containing your JS bundle
  14. * bundleAssetName: "index.android.bundle",
  15. *
  16. * // the entry file for bundle generation
  17. * entryFile: "index.android.js",
  18. *
  19. * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
  20. * bundleCommand: "ram-bundle",
  21. *
  22. * // whether to bundle JS and assets in debug mode
  23. * bundleInDebug: false,
  24. *
  25. * // whether to bundle JS and assets in release mode
  26. * bundleInRelease: true,
  27. *
  28. * // whether to bundle JS and assets in another build variant (if configured).
  29. * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  30. * // The configuration property can be in the following formats
  31. * // 'bundleIn${productFlavor}${buildType}'
  32. * // 'bundleIn${buildType}'
  33. * // bundleInFreeDebug: true,
  34. * // bundleInPaidRelease: true,
  35. * // bundleInBeta: true,
  36. *
  37. * // whether to disable dev mode in custom build variants (by default only disabled in release)
  38. * // for example: to disable dev mode in the staging build type (if configured)
  39. * devDisabledInStaging: true,
  40. * // The configuration property can be in the following formats
  41. * // 'devDisabledIn${productFlavor}${buildType}'
  42. * // 'devDisabledIn${buildType}'
  43. *
  44. * // the root of your project, i.e. where "package.json" lives
  45. * root: "../../",
  46. *
  47. * // where to put the JS bundle asset in debug mode
  48. * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  49. *
  50. * // where to put the JS bundle asset in release mode
  51. * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  52. *
  53. * // where to put drawable resources / React Native assets, e.g. the ones you use via
  54. * // require('./image.png')), in debug mode
  55. * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  56. *
  57. * // where to put drawable resources / React Native assets, e.g. the ones you use via
  58. * // require('./image.png')), in release mode
  59. * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  60. *
  61. * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  62. * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  63. * // date; if you have any other folders that you want to ignore for performance reasons (gradle
  64. * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  65. * // for example, you might want to remove it from here.
  66. * inputExcludes: ["android/**", "ios/**"],
  67. *
  68. * // override which node gets called and with what additional arguments
  69. * nodeExecutableAndArgs: ["node"],
  70. *
  71. * // supply additional arguments to the packager
  72. * extraPackagerArgs: []
  73. * ]
  74. */
  75. project.ext.react = [
  76. entryFile: "index.js",
  77. enableHermes: true, // clean and rebuild if changing
  78. ]
  79. apply from: "../../node_modules/react-native/react.gradle"
  80. project.ext.vectoricons = [
  81. iconFontNames: [ 'MaterialCommunityIcons.ttf'] // Name of the font files you want to copy
  82. ]
  83. apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
  84. /**
  85. * Set this to true to create two separate APKs instead of one:
  86. * - An APK that only works on ARM devices
  87. * - An APK that only works on x86 devices
  88. * The advantage is the size of the APK is reduced by about 4MB.
  89. * Upload all the APKs to the Play Store and people will download
  90. * the correct one based on the CPU architecture of their device.
  91. */
  92. def enableSeparateBuildPerCPUArchitecture = false
  93. /**
  94. * Run Proguard to shrink the Java bytecode in release builds.
  95. */
  96. def enableProguardInReleaseBuilds = true
  97. /**
  98. * The preferred build flavor of JavaScriptCore.
  99. *
  100. * For example, to use the international variant, you can use:
  101. * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
  102. *
  103. * The international variant includes ICU i18n library and necessary data
  104. * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
  105. * give correct results when using with locales other than en-US. Note that
  106. * this variant is about 6MiB larger per architecture than default.
  107. */
  108. def jscFlavor = 'org.webkit:android-jsc:+'
  109. /**
  110. * Whether to enable the Hermes VM.
  111. *
  112. * This should be set on project.ext.react and mirrored here. If it is not set
  113. * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
  114. * and the benefits of using Hermes will therefore be sharply reduced.
  115. */
  116. def enableHermes = project.ext.react.get("enableHermes", false);
  117. android {
  118. compileSdkVersion rootProject.ext.compileSdkVersion
  119. compileOptions {
  120. sourceCompatibility JavaVersion.VERSION_1_8
  121. targetCompatibility JavaVersion.VERSION_1_8
  122. }
  123. defaultConfig {
  124. applicationId 'fr.amicaleinsat.application'
  125. minSdkVersion rootProject.ext.minSdkVersion
  126. targetSdkVersion rootProject.ext.targetSdkVersion
  127. versionCode 23
  128. versionName "3.0.6"
  129. missingDimensionStrategy 'react-native-camera', 'general'
  130. }
  131. splits {
  132. abi {
  133. reset()
  134. enable enableSeparateBuildPerCPUArchitecture
  135. universalApk false // If true, also generate a universal APK
  136. include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
  137. }
  138. }
  139. signingConfigs {
  140. debug {
  141. storeFile file('debug.keystore')
  142. storePassword 'android'
  143. keyAlias 'androiddebugkey'
  144. keyPassword 'android'
  145. }
  146. release {
  147. if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
  148. storeFile file(MYAPP_UPLOAD_STORE_FILE)
  149. storePassword MYAPP_UPLOAD_STORE_PASSWORD
  150. keyAlias MYAPP_UPLOAD_KEY_ALIAS
  151. keyPassword MYAPP_UPLOAD_KEY_PASSWORD
  152. }
  153. }
  154. }
  155. buildTypes {
  156. debug {
  157. signingConfig signingConfigs.debug
  158. }
  159. release {
  160. // Caution! In production, you need to generate your own keystore file.
  161. // see https://facebook.github.io/react-native/docs/signed-apk-android.
  162. signingConfig signingConfigs.release
  163. minifyEnabled enableProguardInReleaseBuilds
  164. proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  165. }
  166. }
  167. packagingOptions {
  168. pickFirst "lib/armeabi-v7a/libc++_shared.so"
  169. pickFirst "lib/arm64-v8a/libc++_shared.so"
  170. pickFirst "lib/x86/libc++_shared.so"
  171. pickFirst "lib/x86_64/libc++_shared.so"
  172. }
  173. // Force so_loader version to fix crash on apk release
  174. configurations.all {
  175. resolutionStrategy {
  176. force "com.facebook.soloader:soloader:0.8.2"
  177. }
  178. }
  179. // applicationVariants are e.g. debug, release
  180. applicationVariants.all { variant ->
  181. variant.outputs.each { output ->
  182. // For each separate APK per architecture, set a unique version code as described here:
  183. // https://developer.android.com/studio/build/configure-apk-splits.html
  184. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
  185. def abi = output.getFilter(OutputFile.ABI)
  186. if (abi != null) { // null for the universal-debug, universal-release variants
  187. output.versionCodeOverride =
  188. versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
  189. }
  190. }
  191. }
  192. }
  193. dependencies {
  194. implementation fileTree(dir: "libs", include: ["*.jar"])
  195. //noinspection GradleDynamicVersion
  196. implementation "com.facebook.react:react-native:+" // From node_modules
  197. implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
  198. debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
  199. exclude group:'com.facebook.fbjni'
  200. }
  201. debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
  202. exclude group:'com.facebook.flipper'
  203. }
  204. debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
  205. exclude group:'com.facebook.flipper'
  206. }
  207. if (enableHermes) {
  208. def hermesPath = "../../node_modules/hermes-engine/android/";
  209. debugImplementation files(hermesPath + "hermes-debug.aar")
  210. releaseImplementation files(hermesPath + "hermes-release.aar")
  211. } else {
  212. implementation jscFlavor
  213. }
  214. }
  215. // Run this once to be able to run the application with BUCK
  216. // puts all compile dependencies into folder libs for BUCK to use
  217. task copyDownloadableDepsToLibs(type: Copy) {
  218. from configurations.compile
  219. into 'libs'
  220. }
  221. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)