build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import org.apache.tools.ant.taskdefs.condition.Os
  2. apply plugin: 'com.android.application'
  3. android {
  4. compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
  5. buildToolsVersion PROP_BUILD_TOOLS_VERSION
  6. defaultConfig {
  7. applicationId "com.edufound.mobile"
  8. minSdkVersion PROP_MIN_SDK_VERSION
  9. targetSdkVersion PROP_TARGET_SDK_VERSION
  10. versionCode 91000
  11. versionName "9.1"
  12. ndk {
  13. abiFilters 'armeabi-v7a'
  14. }
  15. externalNativeBuild {
  16. ndkBuild {
  17. if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
  18. // skip the NDK Build step if PROP_NDK_MODE is none
  19. targets 'cocos2djs'
  20. arguments 'NDK_TOOLCHAIN_VERSION=clang'
  21. def module_paths = [project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x"),
  22. project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos"),
  23. project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/external")]
  24. if (Os.isFamily(Os.FAMILY_WINDOWS)) {
  25. arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
  26. } else {
  27. arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
  28. }
  29. arguments '-j' + Runtime.runtime.availableProcessors()
  30. abiFilters.addAll(PROP_APP_ABI.split(':').collect { it as String })
  31. }
  32. }
  33. }
  34. }
  35. sourceSets.main {
  36. java.srcDirs "../src", "src"
  37. res.srcDirs "../res", 'res'
  38. jniLibs.srcDirs "../libs", 'libs'
  39. manifest.srcFile "AndroidManifest.xml"
  40. }
  41. externalNativeBuild {
  42. ndkBuild {
  43. if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {
  44. // skip the NDK Build step if PROP_NDK_MODE is none
  45. path "jni/Android.mk"
  46. }
  47. }
  48. }
  49. signingConfigs {
  50. release {
  51. if (project.hasProperty("RELEASE_STORE_FILE")) {
  52. storeFile file(RELEASE_STORE_FILE)
  53. storePassword RELEASE_STORE_PASSWORD
  54. keyAlias RELEASE_KEY_ALIAS
  55. keyPassword RELEASE_KEY_PASSWORD
  56. }
  57. }
  58. }
  59. buildTypes {
  60. release {
  61. debuggable false
  62. jniDebuggable false
  63. renderscriptDebuggable false
  64. minifyEnabled true
  65. shrinkResources true
  66. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  67. if (project.hasProperty("RELEASE_STORE_FILE")) {
  68. signingConfig signingConfigs.release
  69. }
  70. externalNativeBuild {
  71. ndkBuild {
  72. arguments 'NDK_DEBUG=0'
  73. }
  74. }
  75. }
  76. // debug {
  77. // debuggable true
  78. // jniDebuggable true
  79. // renderscriptDebuggable true
  80. // externalNativeBuild {
  81. // ndkBuild {
  82. // arguments 'NDK_DEBUG=1'
  83. // }
  84. // }
  85. // }
  86. }
  87. }
  88. android.applicationVariants.all { variant ->
  89. // delete previous files first
  90. delete "${buildDir}/intermediates/merged_assets/${variant.dirName}"
  91. variant.mergeAssets.doLast {
  92. def sourceDir = "${buildDir}/../../../../.."
  93. copy {
  94. from "${sourceDir}/assets"
  95. into "${outputDir}/assets"
  96. }
  97. copy {
  98. from "${sourceDir}/src"
  99. into "${outputDir}/src"
  100. }
  101. copy {
  102. from "${sourceDir}/jsb-adapter"
  103. into "${outputDir}/jsb-adapter"
  104. }
  105. copy {
  106. from "${sourceDir}/main.js"
  107. from "${sourceDir}/project.json"
  108. into outputDir
  109. }
  110. }
  111. }
  112. dependencies {
  113. implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
  114. implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  115. implementation "com.android.support:appcompat-v7:28.0.0"
  116. implementation fileTree(dir: "G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])
  117. implementation 'com.google.code.gson:gson:2.8.6'
  118. implementation 'com.google.android.gms:play-services-instantapps:16.0.0'
  119. //微信登录、微信支付等
  120. implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
  121. implementation project(':libcocos2dx')
  122. }