build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-android-extensions'
  4. apply plugin: 'com.jakewharton.butterknife'
  5. android {
  6. compileSdkVersion 29
  7. buildToolsVersion "29.0.3"
  8. defaultConfig {
  9. applicationId "com.cj.autojs.dtok"
  10. minSdkVersion 21
  11. targetSdkVersion 29
  12. versionCode 1
  13. versionName "1.1"
  14. buildConfigField "String", "AGENT_USER_ID", "\"1\""
  15. buildConfigField "String", "PRODUCT_NAME","\"dtok\""
  16. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  17. }
  18. lintOptions {
  19. abortOnError false
  20. disable 'MissingTranslation'
  21. disable 'ExtraTranslation'
  22. }
  23. compileOptions {
  24. sourceCompatibility JavaVersion.VERSION_1_8
  25. targetCompatibility JavaVersion.VERSION_1_8
  26. }
  27. splits {
  28. // Configures multiple APKs based on ABI.
  29. abi {
  30. // Enables building multiple APKs per ABI.
  31. enable true
  32. // By default all ABIs are included, so use reset() and include to specify that we only
  33. // want APKs for x86 and x86_64.
  34. // Resets the list of ABIs that Gradle should create APKs for to none.
  35. reset()
  36. // Specifies a list of ABIs that Gradle should create APKs for.
  37. include "x86", "armeabi-v7a","arm64-v8a"
  38. // Specifies that we do not want to also generate a universal APK that includes all ABIs.
  39. universalApk false
  40. }
  41. buildTypes {
  42. release {
  43. minifyEnabled false
  44. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  45. }
  46. }
  47. }
  48. }
  49. def buildApkPluginForAbi(File pluginProjectDir, String abi) {
  50. copy {
  51. from file('..\\app\\release\\')
  52. into new File(pluginProjectDir, 'app\\src\\main\\assets')
  53. def fileName = "inrt-" + abi + "-release.apk"
  54. include fileName
  55. rename fileName, 'template.apk'
  56. }
  57. exec {
  58. workingDir pluginProjectDir
  59. commandLine 'gradlew.bat', 'assembleRelease'
  60. }
  61. copy {
  62. from new File(pluginProjectDir, 'app\\build\\outputs\\apk\\release')
  63. into file('..\\common\\release')
  64. def fileName = '打包插件-' + versions.appVersionName + '-release.apk'
  65. include fileName
  66. rename fileName, '打包插件-' + abi + '-' + versions.appVersionName + '-release.apk'
  67. }
  68. }
  69. task buildApkPlugin {
  70. doLast {
  71. def pluginProjectDirPath = '..\\..\\AutoJsApkBuilderPlugin'
  72. def pluginProjectDir = file(pluginProjectDirPath)
  73. if (!pluginProjectDir.exists() || !pluginProjectDir.isDirectory()) {
  74. println 'pluginProjectDir not exists'
  75. return
  76. }
  77. buildApkPluginForAbi(pluginProjectDir, 'armeabi-v7a')
  78. buildApkPluginForAbi(pluginProjectDir, 'x86')
  79. buildApkPluginForAbi(pluginProjectDir, 'arm64-v8a')
  80. }
  81. }
  82. tasks.whenTaskAdded { task ->
  83. if (task.name == 'assembleRelease') {
  84. task.finalizedBy 'buildApkPlugin'
  85. }
  86. }
  87. repositories {
  88. flatDir {
  89. dirs 'libs'
  90. }
  91. google()
  92. }
  93. dependencies {
  94. implementation 'com.makeramen:roundedimageview:2.3.0'
  95. // implementation 'com.github.ZLYang110:MyPermission:1.0'
  96. implementation fileTree(dir: "libs", include: ["*.jar"])
  97. //Glide
  98. implementation('com.github.bumptech.glide:glide:4.2.0', {
  99. exclude group: 'com.android.support'
  100. })
  101. implementation ('com.github.lzyzsd:jsbridge:2.0.0'){
  102. exclude group: 'com.github.lzyzsd.jsbridge', module: 'jsbridge-debug'
  103. }
  104. implementation('com.jakewharton:butterknife:10.2.1', {
  105. exclude group: 'com.android.support'
  106. })
  107. annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
  108. implementation 'com.tencent.sonic:sdk:3.1.0'
  109. implementation 'androidx.appcompat:appcompat:1.1.0'
  110. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  111. implementation 'com.google.android.material:material:1.5.0-alpha02'
  112. // implementation 'androidx.activity:activity:1.8.0'
  113. // implementation 'com.google.android.material:material:1.11.0'
  114. // implementation files('libs/activity-1.7.2.aar')
  115. implementation "androidx.activity:activity:1.2.4"
  116. implementation 'com.blankj:utilcodex:1.31.1'
  117. // implementation 'com.google.android.material:material:1.11.0'
  118. // implementation 'androidx.activity:activity:1.8.0'
  119. testImplementation 'junit:junit:4.12'
  120. androidTestImplementation 'androidx.test.ext:junit:1.1.1'
  121. androidTestImplementation "android.arch.core:core-testing:1.1.0"
  122. androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  123. implementation project(':autojs')
  124. implementation 'com.yanzhenjie:permission:2.0.3'
  125. }