build.gradle 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. } else if (channel == ("2007")) {
  104. newoutputFile = "\\oppo\\"
  105. }
  106. output.outputFileName = new File(newoutputFile, fileName)
  107. }
  108. }
  109. }
  110. externalNativeBuild {
  111. ndkBuild {
  112. arguments 'NDK_DEBUG=0'
  113. }
  114. }
  115. }
  116. // debug {
  117. // debuggable true
  118. // jniDebuggable true
  119. // renderscriptDebuggable true
  120. // externalNativeBuild {
  121. // ndkBuild {
  122. // arguments 'NDK_DEBUG=1'
  123. // }
  124. // }
  125. // }
  126. }
  127. productFlavors {
  128. //义方
  129. channel_efunbox {
  130. signingConfig signingConfigs.release
  131. manifestPlaceholders = [
  132. appCode: "2006",
  133. appIcon: "@drawable/icon",
  134. ]
  135. }
  136. //应用宝
  137. channel_yyb {
  138. signingConfig signingConfigs.release
  139. manifestPlaceholders = [
  140. appCode: "2001",
  141. appIcon: "@drawable/icon",
  142. ]
  143. }
  144. //360应用市场
  145. channel_360 {
  146. signingConfig signingConfigs.release
  147. manifestPlaceholders = [
  148. appCode: "2002",
  149. appIcon: "@drawable/icon",
  150. ]
  151. }
  152. //百度手机助手
  153. channel_bdsjzs {
  154. signingConfig signingConfigs.release
  155. manifestPlaceholders = [
  156. appCode: "2003",
  157. appIcon: "@drawable/icon",
  158. ]
  159. }
  160. //vivo
  161. channel_vivo {
  162. signingConfig signingConfigs.release
  163. manifestPlaceholders = [
  164. appCode: "2007",
  165. appIcon: "@drawable/icon",
  166. ]
  167. }
  168. //小米
  169. channel_xiaomi {
  170. signingConfig signingConfigs.release
  171. manifestPlaceholders = [
  172. appCode: "2008",
  173. appIcon: "@drawable/icon",
  174. ]
  175. }
  176. //华科
  177. channel_huake {
  178. signingConfig signingConfigs.release
  179. manifestPlaceholders = [
  180. appCode: "2012",
  181. appIcon: "@drawable/icon",
  182. ]
  183. }
  184. //步步高
  185. channel_bubugao {
  186. signingConfig signingConfigs.release
  187. manifestPlaceholders = [
  188. appCode: "2013",
  189. appIcon: "@drawable/icon",
  190. ]
  191. }
  192. //状元才子
  193. channel_zhuangyuancaizi {
  194. signingConfig signingConfigs.release
  195. manifestPlaceholders = [
  196. appCode: "2015",
  197. appIcon: "@drawable/icon",
  198. ]
  199. }
  200. //广西优学
  201. channel_guangxiyouxue {
  202. signingConfig signingConfigs.release
  203. manifestPlaceholders = [
  204. appCode: "2011",
  205. appIcon: "@drawable/icon",
  206. ]
  207. }
  208. //字节跳动
  209. channel_bytedance {
  210. signingConfig signingConfigs.release
  211. manifestPlaceholders = [
  212. appCode: "2020",
  213. appIcon: "@drawable/icon",
  214. ]
  215. }
  216. //字节跳动
  217. channel_oppo {
  218. signingConfig signingConfigs.release
  219. manifestPlaceholders = [
  220. appCode: "2004",
  221. appIcon: "@drawable/icon",
  222. ]
  223. }
  224. }
  225. productFlavors.all {
  226. flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: manifestPlaceholders.appCode, icon: manifestPlaceholders.appIcon]
  227. }
  228. compileOptions {
  229. sourceCompatibility JavaVersion.VERSION_1_8
  230. targetCompatibility JavaVersion.VERSION_1_8
  231. }
  232. }
  233. android.applicationVariants.all { variant ->
  234. // delete previous files first
  235. delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
  236. //修改 报警错误 API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.It will be removed at the end of 2019.
  237. // variant.mergeAssets.doLast {
  238. variant.mergeAssetsProvider.get().doLast {
  239. def sourceDir = "${buildDir}/../../../../.."
  240. // def sourceDir = "${buildDir}/../../../build/jsb-link"
  241. copy {
  242. from "${sourceDir}/assets"
  243. into "${outputDir}/assets"
  244. into outputDir.dir("assets")
  245. }
  246. copy {
  247. from "${sourceDir}/src"
  248. into "${outputDir}/src"
  249. into outputDir.dir("src")
  250. }
  251. copy {
  252. from "${sourceDir}/jsb-adapter"
  253. into "${outputDir}/jsb-adapter"
  254. into outputDir.dir("jsb-adapter")
  255. }
  256. copy {
  257. from "${sourceDir}/main.js"
  258. from "${sourceDir}/project.json"
  259. into outputDir
  260. }
  261. }
  262. }
  263. dependencies {
  264. implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
  265. implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  266. implementation "com.android.support:appcompat-v7:28.0.0"
  267. implementation fileTree(dir: "G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
  268. implementation 'com.google.code.gson:gson:2.8.6'
  269. implementation 'com.google.android.gms:play-services-instantapps:16.0.0'
  270. //微信登录、微信支付等
  271. implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
  272. implementation project(':libcocos2dx')
  273. // 友盟基础组件库(所有友盟业务SDK都依赖基础组件库)
  274. implementation 'com.umeng.umsdk:common:9.4.4'// (必选)
  275. implementation 'com.umeng.umsdk:asms:1.4.1'// asms包依赖必选
  276. // implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选
  277. //友盟Push依赖
  278. api 'com.umeng.umsdk:push:6.4.5'
  279. //友盟P厂商推送渠道(小米)
  280. api 'com.umeng.umsdk:xiaomi-umengaccs:1.2.6'
  281. implementation 'com.umeng.umsdk:xiaomi-push:4.8.1'
  282. //友盟P厂商推送(华为)
  283. api 'com.umeng.umsdk:huawei-umengaccs:1.3.5'
  284. api 'com.huawei.hms:push:5.3.0.304'
  285. //友盟厂商推送(魅族)
  286. api 'com.umeng.umsdk:meizu-umengaccs:1.1.5'
  287. api 'com.umeng.umsdk:meizu-push:4.1.4'
  288. //友盟厂商推送(OPPO)
  289. api 'com.umeng.umsdk:oppo-umengaccs:1.0.7-fix'
  290. implementation 'com.umeng.umsdk:oppo-push:2.1.0'
  291. //友盟厂商(ViVo)
  292. api 'com.umeng.umsdk:vivo-umengaccs:1.1.5'
  293. implementation 'com.umeng.umsdk:vivo-push:3.0.0.3'
  294. }