build.gradle 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. * // whether to bundle JS and assets in debug mode
  20. * bundleInDebug: false,
  21. *
  22. * // whether to bundle JS and assets in release mode
  23. * bundleInRelease: true,
  24. *
  25. * // whether to bundle JS and assets in another build variant (if configured).
  26. * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  27. * // The configuration property can be in the following formats
  28. * // 'bundleIn${productFlavor}${buildType}'
  29. * // 'bundleIn${buildType}'
  30. * // bundleInFreeDebug: true,
  31. * // bundleInPaidRelease: true,
  32. * // bundleInBeta: true,
  33. *
  34. * // whether to disable dev mode in custom build variants (by default only disabled in release)
  35. * // for example: to disable dev mode in the staging build type (if configured)
  36. * devDisabledInStaging: true,
  37. * // The configuration property can be in the following formats
  38. * // 'devDisabledIn${productFlavor}${buildType}'
  39. * // 'devDisabledIn${buildType}'
  40. *
  41. * // the root of your project, i.e. where "package.json" lives
  42. * root: "../../",
  43. *
  44. * // where to put the JS bundle asset in debug mode
  45. * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  46. *
  47. * // where to put the JS bundle asset in release mode
  48. * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  49. *
  50. * // where to put drawable resources / React Native assets, e.g. the ones you use via
  51. * // require('./image.png')), in debug mode
  52. * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  53. *
  54. * // where to put drawable resources / React Native assets, e.g. the ones you use via
  55. * // require('./image.png')), in release mode
  56. * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  57. *
  58. * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  59. * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  60. * // date; if you have any other folders that you want to ignore for performance reasons (gradle
  61. * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  62. * // for example, you might want to remove it from here.
  63. * inputExcludes: ["android/**", "ios/**"],
  64. *
  65. * // override which node gets called and with what additional arguments
  66. * nodeExecutableAndArgs: ["node"],
  67. *
  68. * // supply additional arguments to the packager
  69. * extraPackagerArgs: []
  70. * ]
  71. */
  72. project.ext.react = [
  73. entryFile: "index.js"
  74. ]
  75. apply from: "../../node_modules/react-native/react.gradle"
  76. /**
  77. * Set this to true to create two separate APKs instead of one:
  78. * - An APK that only works on ARM devices
  79. * - An APK that only works on x86 devices
  80. * The advantage is the size of the APK is reduced by about 4MB.
  81. * Upload all the APKs to the Play Store and people will download
  82. * the correct one based on the CPU architecture of their device.
  83. */
  84. def enableSeparateBuildPerCPUArchitecture = false
  85. /**
  86. * Run Proguard to shrink the Java bytecode in release builds.
  87. */
  88. def enableProguardInReleaseBuilds = false
  89. android {
  90. compileSdkVersion rootProject.ext.compileSdkVersion
  91. aaptOptions.cruncherEnabled = false
  92. aaptOptions.useNewCruncher = false
  93. compileOptions {
  94. sourceCompatibility JavaVersion.VERSION_1_8
  95. targetCompatibility JavaVersion.VERSION_1_8
  96. }
  97. defaultConfig {
  98. applicationId "com.edufound.mobile"
  99. minSdkVersion rootProject.ext.minSdkVersion
  100. targetSdkVersion rootProject.ext.targetSdkVersion
  101. versionCode 80000
  102. versionName "8.0.0"
  103. }
  104. signingConfigs {
  105. release {
  106. storeFile file(MYAPP_RELEASE_STORE_FILE)
  107. storePassword MYAPP_RELEASE_STORE_PASSWORD
  108. keyAlias MYAPP_RELEASE_KEY_ALIAS
  109. keyPassword MYAPP_RELEASE_KEY_PASSWORD
  110. }
  111. }
  112. splits {
  113. abi {
  114. reset()
  115. enable enableSeparateBuildPerCPUArchitecture
  116. universalApk false // If true, also generate a universal APK
  117. include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
  118. }
  119. }
  120. buildTypes {
  121. release {
  122. minifyEnabled enableProguardInReleaseBuilds
  123. proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  124. signingConfig signingConfigs.release
  125. }
  126. debug {
  127. signingConfig signingConfigs.release
  128. }
  129. }
  130. // applicationVariants are e.g. debug, release
  131. applicationVariants.all { variant ->
  132. variant.outputs.each { output ->
  133. // For each separate APK per architecture, set a unique version code as described here:
  134. // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
  135. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
  136. def abi = output.getFilter(OutputFile.ABI)
  137. if (abi != null) { // null for the universal-debug, universal-release variants
  138. output.versionCodeOverride =
  139. versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
  140. }
  141. }
  142. }
  143. }
  144. dependencies {
  145. implementation project(':react-native-yunpeng-alipay')
  146. implementation project(':react-native-splash-screen')
  147. implementation project(':react-native-device-info')
  148. implementation project(':react-native-wechat')
  149. implementation project(':react-native-image-picker')
  150. implementation project(':react-native-orientation')
  151. implementation project(':react-native-video')
  152. implementation project(':react-native-gesture-handler')
  153. implementation project(':react-native-image-picker')
  154. implementation fileTree(dir: "libs", include: ["*.jar"])
  155. // 如果你需要支持GIF动图
  156. implementation 'com.facebook.fresco:animated-gif:1.10.0'
  157. implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  158. implementation "com.facebook.react:react-native:+" // From node_modules
  159. }
  160. // Run this once to be able to run the application with BUCK
  161. // puts all compile dependencies into folder libs for BUCK to use
  162. task copyDownloadableDepsToLibs(type: Copy) {
  163. from configurations.compile
  164. into 'libs'
  165. }