build.gradle 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'com.loveota.lbsdk'
  3. apply from: project(':lebian').file('lebian_app.gradle')
  4. apply from: '../build_cust.gradle'
  5. android {
  6. compileSdkVersion 30
  7. buildToolsVersion "30.0.3"
  8. defaultConfig {
  9. applicationId ro.applicationId
  10. minSdkVersion 21
  11. targetSdkVersion 28
  12. versionCode ro.versionCode
  13. versionName ro.versionName
  14. ndk {
  15. //注意这个需要根据集成游戏支持的架构配置,配置成和你们游戏一样
  16. abiFilters 'armeabi-v7a'
  17. }
  18. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  19. }
  20. signingConfigs {
  21. release {
  22. storeFile file(ro.keyFile)
  23. keyAlias ro.keyAlias
  24. keyPassword ro.keyPassword
  25. storePassword ro.storePassword
  26. v2SigningEnabled false
  27. }
  28. }
  29. buildTypes {
  30. release {
  31. minifyEnabled false
  32. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  33. signingConfig signingConfigs.release
  34. }
  35. }
  36. compileOptions {
  37. sourceCompatibility JavaVersion.VERSION_1_8
  38. targetCompatibility JavaVersion.VERSION_1_8
  39. }
  40. }
  41. dependencies {
  42. implementation fileTree(dir: "libs", include: ["*.jar"])
  43. implementation project(":yunMain")
  44. }
  45. tasks.whenTaskAdded { task ->
  46. if (task.name.equalsIgnoreCase("assembleRelease")) {
  47. task.doLast {
  48. android.applicationVariants.all { variant ->
  49. // 如果是正式版打包
  50. if (variant.name.equalsIgnoreCase("release")) {
  51. File outputPath = new File("${ro.apkDir}")
  52. if (!outputPath.exists()) {
  53. mkdir(outputPath)
  54. }
  55. // 拷贝apk文件
  56. copy {
  57. from variant.outputs[0].outputFile
  58. into outputPath
  59. // 重命名导出名称
  60. rename {
  61. "${ro.apkName}"
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }