build.gradle 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. compileOptions {
  219. sourceCompatibility JavaVersion.VERSION_1_8
  220. targetCompatibility JavaVersion.VERSION_1_8
  221. }
  222. }
  223. android.applicationVariants.all { variant ->
  224. // delete previous files first
  225. delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
  226. //修改 报警错误 API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.It will be removed at the end of 2019.
  227. // variant.mergeAssets.doLast {
  228. variant.mergeAssetsProvider.get().doLast {
  229. def sourceDir = "${buildDir}/../../../../.."
  230. copy {
  231. from "${sourceDir}/assets"
  232. into "${outputDir}/assets"
  233. into outputDir.dir("assets")
  234. }
  235. copy {
  236. from "${sourceDir}/src"
  237. into "${outputDir}/src"
  238. into outputDir.dir("src")
  239. }
  240. copy {
  241. from "${sourceDir}/jsb-adapter"
  242. into "${outputDir}/jsb-adapter"
  243. into outputDir.dir("jsb-adapter")
  244. }
  245. copy {
  246. from "${sourceDir}/main.js"
  247. from "${sourceDir}/project.json"
  248. into outputDir
  249. }
  250. }
  251. }
  252. dependencies {
  253. implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
  254. implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  255. implementation "com.android.support:appcompat-v7:28.0.0"
  256. implementation fileTree(dir: "G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
  257. implementation 'com.google.code.gson:gson:2.8.6'
  258. implementation 'com.google.android.gms:play-services-instantapps:16.0.0'
  259. //微信登录、微信支付等
  260. implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
  261. implementation project(':libcocos2dx')
  262. // 友盟基础组件库(所有友盟业务SDK都依赖基础组件库)
  263. implementation 'com.umeng.umsdk:common:9.4.4'// (必选)
  264. implementation 'com.umeng.umsdk:asms:1.4.1'// asms包依赖必选
  265. // implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选
  266. //友盟Push依赖
  267. api 'com.umeng.umsdk:push:6.4.5'
  268. //友盟P厂商推送渠道(小米)
  269. api 'com.umeng.umsdk:xiaomi-umengaccs:1.2.6'
  270. implementation 'com.umeng.umsdk:xiaomi-push:4.8.1'
  271. //友盟P厂商推送(华为)
  272. api 'com.umeng.umsdk:huawei-umengaccs:1.3.5'
  273. api 'com.huawei.hms:push:5.3.0.304'
  274. //友盟厂商推送(魅族)
  275. api 'com.umeng.umsdk:meizu-umengaccs:1.1.5'
  276. api 'com.umeng.umsdk:meizu-push:4.1.4'
  277. //友盟厂商推送(OPPO)
  278. api 'com.umeng.umsdk:oppo-umengaccs:1.0.7-fix'
  279. implementation 'com.umeng.umsdk:oppo-push:2.1.0'
  280. //友盟厂商(ViVo)
  281. api 'com.umeng.umsdk:vivo-umengaccs:1.1.5'
  282. implementation 'com.umeng.umsdk:vivo-push:3.0.0.3'
  283. }