build.gradle 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. import org.apache.tools.ant.taskdefs.condition.Os
  2. apply plugin: 'com.android.application'
  3. def releaseTime() {
  4. return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
  5. }
  6. android {
  7. compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
  8. buildToolsVersion PROP_BUILD_TOOLS_VERSION
  9. defaultConfig {
  10. applicationId "com.edufound.mobile"
  11. minSdkVersion PROP_MIN_SDK_VERSION
  12. targetSdkVersion PROP_TARGET_SDK_VERSION
  13. versionCode 91000
  14. versionName "9.1.0.0.0"
  15. flavorDimensions "versionCode"
  16. manifestPlaceholders = [UMENG_CHANNEL_VALUE: "2006"]//添加一个默认渠道号
  17. ndk {
  18. abiFilters 'armeabi-v7a'
  19. }
  20. externalNativeBuild {
  21. ndkBuild {
  22. if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
  23. // skip the NDK Build step if PROP_NDK_MODE is none
  24. targets 'cocos2djs'
  25. arguments 'NDK_TOOLCHAIN_VERSION=clang'
  26. def module_paths = [project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x"),
  27. project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos"),
  28. project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/external")]
  29. if (Os.isFamily(Os.FAMILY_WINDOWS)) {
  30. arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
  31. } else {
  32. arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
  33. }
  34. arguments '-j' + Runtime.runtime.availableProcessors()
  35. abiFilters.addAll(PROP_APP_ABI.split(':').collect { it as String })
  36. }
  37. }
  38. }
  39. }
  40. sourceSets.main {
  41. java.srcDirs "../src", "src"
  42. res.srcDirs "../res", 'res'
  43. jniLibs.srcDirs "../libs", 'libs'
  44. manifest.srcFile "AndroidManifest.xml"
  45. }
  46. externalNativeBuild {
  47. ndkBuild {
  48. if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
  49. // skip the NDK Build step if PROP_NDK_MODE is none
  50. path "jni/Android.mk"
  51. }
  52. }
  53. }
  54. signingConfigs {
  55. release {
  56. if (project.hasProperty("RELEASE_STORE_FILE")) {
  57. storeFile file(RELEASE_STORE_FILE)
  58. storePassword RELEASE_STORE_PASSWORD
  59. keyAlias RELEASE_KEY_ALIAS
  60. keyPassword RELEASE_KEY_PASSWORD
  61. }
  62. }
  63. }
  64. buildTypes {
  65. release {
  66. debuggable false
  67. jniDebuggable false
  68. renderscriptDebuggable false
  69. minifyEnabled true
  70. shrinkResources true
  71. zipAlignEnabled true
  72. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  73. if (project.hasProperty("RELEASE_STORE_FILE")) {
  74. signingConfig signingConfigs.release
  75. }
  76. applicationVariants.all { variant ->
  77. variant.outputs.each { output ->
  78. def outputFile = output.outputFileName
  79. if (outputFile != null && output.outputFileName.endsWith('.apk')) {
  80. def fileName = "efunbox_tv_v${defaultConfig.versionCode}_${releaseTime()}_${variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE}_r.apk"
  81. def channel = variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE;
  82. def newoutputFile = "";
  83. if (channel == ("2006")) {
  84. newoutputFile = "\\义方\\"
  85. } else if (channel == ("2001")) {
  86. newoutputFile = "\\应用宝\\"
  87. } else if (channel == ("2002")) {
  88. newoutputFile = "\\360应用市场\\"
  89. } else if (channel == ("2003")) {
  90. newoutputFile = "\\百度手机助手\\"
  91. } else if (channel == ("2008")) {
  92. newoutputFile = "\\小米\\"
  93. } else if (channel == ("2012")) {
  94. newoutputFile = "\\华科\\"
  95. } else if (channel == ("2013")) {
  96. newoutputFile = "\\步步高\\"
  97. } else if (channel == ("2015")) {
  98. newoutputFile = "\\状元才子\\"
  99. } else if (channel == ("2011")) {
  100. newoutputFile = "\\广西优学\\"
  101. } else if (channel == ("2007")) {
  102. newoutputFile = "\\vivo\\"
  103. }
  104. output.outputFileName = new File(newoutputFile, fileName)
  105. }
  106. }
  107. }
  108. externalNativeBuild {
  109. ndkBuild {
  110. arguments 'NDK_DEBUG=0'
  111. }
  112. }
  113. }
  114. // debug {
  115. // debuggable true
  116. // jniDebuggable true
  117. // renderscriptDebuggable true
  118. // externalNativeBuild {
  119. // ndkBuild {
  120. // arguments 'NDK_DEBUG=1'
  121. // }
  122. // }
  123. // }
  124. }
  125. productFlavors {
  126. //义方
  127. channel_efunbox {
  128. signingConfig signingConfigs.release
  129. manifestPlaceholders = [
  130. appCode: "2006",
  131. appIcon: "@drawable/icon",
  132. ]
  133. }
  134. //应用宝
  135. channel_yyb {
  136. signingConfig signingConfigs.release
  137. manifestPlaceholders = [
  138. appCode: "2001",
  139. appIcon: "@drawable/icon",
  140. ]
  141. }
  142. //360应用市场
  143. channel_360 {
  144. signingConfig signingConfigs.release
  145. manifestPlaceholders = [
  146. appCode: "2002",
  147. appIcon: "@drawable/icon",
  148. ]
  149. }
  150. //百度手机助手
  151. channel_bdsjzs {
  152. signingConfig signingConfigs.release
  153. manifestPlaceholders = [
  154. appCode: "2003",
  155. appIcon: "@drawable/icon",
  156. ]
  157. }
  158. //vivo
  159. channel_vivo {
  160. signingConfig signingConfigs.release
  161. manifestPlaceholders = [
  162. appCode: "2007",
  163. appIcon: "@drawable/icon",
  164. ]
  165. }
  166. //小米
  167. channel_xiaomi {
  168. signingConfig signingConfigs.release
  169. manifestPlaceholders = [
  170. appCode: "2008",
  171. appIcon: "@drawable/icon",
  172. ]
  173. }
  174. //华科
  175. channel_huake {
  176. signingConfig signingConfigs.release
  177. manifestPlaceholders = [
  178. appCode: "2012",
  179. appIcon: "@drawable/icon",
  180. ]
  181. }
  182. //步步高
  183. channel_bubugao {
  184. signingConfig signingConfigs.release
  185. manifestPlaceholders = [
  186. appCode: "2013",
  187. appIcon: "@drawable/icon",
  188. ]
  189. }
  190. //状元才子
  191. channel_zhuangyuancaizi {
  192. signingConfig signingConfigs.release
  193. manifestPlaceholders = [
  194. appCode: "2015",
  195. appIcon: "@drawable/icon",
  196. ]
  197. }
  198. //广西优学
  199. channel_guangxiyouxue {
  200. signingConfig signingConfigs.release
  201. manifestPlaceholders = [
  202. appCode: "2011",
  203. appIcon: "@drawable/icon",
  204. ]
  205. }
  206. //字节跳动
  207. channel_bytedance {
  208. signingConfig signingConfigs.release
  209. manifestPlaceholders = [
  210. appCode: "2020",
  211. appIcon: "@drawable/icon",
  212. ]
  213. }
  214. }
  215. productFlavors.all {
  216. flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: manifestPlaceholders.appCode, icon: manifestPlaceholders.appIcon]
  217. }
  218. }
  219. android.applicationVariants.all { variant ->
  220. // delete previous files first
  221. delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
  222. variant.mergeAssets.doLast {
  223. def sourceDir = "${buildDir}/../../../../.."
  224. copy {
  225. from "${sourceDir}/assets"
  226. into "${outputDir}/assets"
  227. }
  228. copy {
  229. from "${sourceDir}/src"
  230. into "${outputDir}/src"
  231. }
  232. copy {
  233. from "${sourceDir}/jsb-adapter"
  234. into "${outputDir}/jsb-adapter"
  235. }
  236. copy {
  237. from "${sourceDir}/main.js"
  238. from "${sourceDir}/project.json"
  239. into outputDir
  240. }
  241. }
  242. }
  243. dependencies {
  244. implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
  245. implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  246. implementation "com.android.support:appcompat-v7:28.0.0"
  247. implementation fileTree(dir: "G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
  248. implementation 'com.google.code.gson:gson:2.8.6'
  249. implementation 'com.google.android.gms:play-services-instantapps:16.0.0'
  250. //微信登录、微信支付等
  251. implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
  252. implementation project(':libcocos2dx')
  253. // 友盟基础组件库(所有友盟业务SDK都依赖基础组件库)
  254. implementation 'com.umeng.umsdk:common:9.4.4'// (必选)
  255. implementation 'com.umeng.umsdk:asms:1.4.1'// asms包依赖必选
  256. // implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选
  257. //友盟Push依赖
  258. api 'com.umeng.umsdk:push:6.4.5'
  259. //友盟P厂商推送渠道(小米)
  260. api 'com.umeng.umsdk:xiaomi-umengaccs:1.2.6'
  261. implementation 'com.umeng.umsdk:xiaomi-push:4.8.1'
  262. //友盟P厂商推送(华为)
  263. api 'com.umeng.umsdk:huawei-umengaccs:1.3.5'
  264. api 'com.huawei.hms:push:5.3.0.304'
  265. //友盟厂商推送(魅族)
  266. api 'com.umeng.umsdk:meizu-umengaccs:1.1.5'
  267. api 'com.umeng.umsdk:meizu-push:4.1.4'
  268. //友盟厂商推送(OPPO)
  269. api 'com.umeng.umsdk:oppo-umengaccs:1.0.7-fix'
  270. implementation 'com.umeng.umsdk:oppo-push:2.1.0'
  271. //友盟厂商(ViVo)
  272. api 'com.umeng.umsdk:vivo-umengaccs:1.1.5'
  273. implementation 'com.umeng.umsdk:vivo-push:3.0.0.3'
  274. }