kiojiotisha

g

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