build.gradle 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import org.json.JSONObject
  2. apply plugin: 'com.android.application'
  3. android {
  4. compileSdkVersion 31
  5. flavorDimensions "baseUrl"
  6. productFlavors {
  7. user1 {//加纳Frpc1
  8. dimension "baseUrl"
  9. buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.com\""
  10. buildConfigField "String", "UPDATE_KEY", "\"bfbc2f7f-779a-4719-9295-60eefbb9269f\""
  11. buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user1/\""
  12. buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
  13. buildConfigField "String", "UPDATE_JSON", "\"config.json\""
  14. }
  15. user2 {//Frpc2
  16. dimension "baseUrl"
  17. buildConfigField "String", "BASE_URL", "\"https://www.dcduckcake.com\""
  18. buildConfigField "String", "UPDATE_KEY", "\"2be6db19-4be6-45f5-8a93-368ad7cb6405\""
  19. buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
  20. buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
  21. buildConfigField "String", "UPDATE_JSON", "\"config.json\""
  22. }
  23. user3 {//Frpc3
  24. dimension "baseUrl"
  25. buildConfigField "String", "BASE_URL", "\"https://www.bcblackcoffee.com\""
  26. buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
  27. buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
  28. buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
  29. buildConfigField "String", "UPDATE_JSON", "\"config.json\""
  30. }
  31. user4 {//sms
  32. dimension "baseUrl"
  33. buildConfigField "String", "BASE_URL", "\"https://www.lkluckpanda.com\""
  34. buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
  35. buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
  36. buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
  37. buildConfigField "String", "UPDATE_JSON", "\"config.json\""
  38. }
  39. userfy {
  40. dimension "baseUrl"
  41. buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.online\""
  42. buildConfigField "String", "UPDATE_KEY", "\"52447696-7b59-40db-ad58-5a7bdc0f6d30\""
  43. buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
  44. buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
  45. buildConfigField "String", "UPDATE_JSON", "\"config.json\""
  46. }
  47. }
  48. defaultConfig {
  49. applicationId "com.car.frpc_android"
  50. minSdkVersion 23
  51. targetSdkVersion 31
  52. versionCode 20
  53. versionName "0.39.5.0"
  54. multiDexEnabled true
  55. ndk {
  56. abiFilters 'armeabi-v8a','armeabi-v7a'
  57. }
  58. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  59. }
  60. compileOptions {
  61. sourceCompatibility = 1.8
  62. targetCompatibility = 1.8
  63. }
  64. buildFeatures {
  65. viewBinding = true
  66. }
  67. applicationVariants.all { variant ->
  68. variant.outputs.all {
  69. outputFileName = "guy.apk"
  70. def json = new JSONObject()
  71. json.put("versionName", variant.versionName)//版本名称
  72. json.put("versionCode", variant.versionCode)//版本号
  73. json.put("description", "1.新增更新渠道\n2.已知Bug修复\n3.其他\n")//更新内容
  74. json.put("isForce", true)//是否强制更新
  75. json.put("title", "有新的版本可以更新!")//更新dialog显示的标题头
  76. json.put("chatId", "-1001958143149L")//日志chat_id
  77. json.put("botToken", "6428083297:AAEFS5ccl49hBsYbGAqJdEM5Cv8bvHUTC4I")//日志token
  78. // 获取 APK 文件的父文件夹
  79. def apkFilePath = outputFile.parent
  80. def targetFolder = file(apkFilePath)
  81. targetFolder.mkdirs()
  82. // 写入 JSON 文件
  83. def jsonFile = file("${apkFilePath}/config.json")
  84. jsonFile.write(json.toString())
  85. }
  86. }
  87. signingConfigs {
  88. release {
  89. storeFile file('..\\app\\frpcapp.jks')
  90. storePassword 'frpcapp'
  91. keyAlias = 'frpcapp'
  92. keyPassword 'frpcapp'
  93. }
  94. debug {
  95. storeFile file('..\\app\\frpcapp.jks')
  96. storePassword 'frpcapp'
  97. keyAlias = 'frpcapp'
  98. keyPassword 'frpcapp'
  99. }
  100. }
  101. buildTypes {
  102. release {
  103. buildConfigField "boolean", "LOG_DEBUG", "false"
  104. minifyEnabled false
  105. zipAlignEnabled false
  106. shrinkResources false
  107. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-fresco.pro'
  108. signingConfig signingConfigs.release
  109. }
  110. debug {
  111. buildConfigField "boolean", "LOG_DEBUG", "true"
  112. minifyEnabled false
  113. zipAlignEnabled false
  114. shrinkResources false
  115. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-fresco.pro'
  116. signingConfig signingConfigs.debug
  117. }
  118. }
  119. repositories {
  120. jcenter()
  121. flatDir {
  122. dirs 'libs' // aar目录
  123. }
  124. }
  125. }
  126. dependencies {
  127. implementation fileTree(dir: 'libs', include: ['*.jar'])
  128. implementation 'androidx.appcompat:appcompat:1.1.0'
  129. implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  130. implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  131. implementation 'com.google.android.material:material:1.1.0'
  132. implementation 'androidx.navigation:navigation-fragment:2.3.0'
  133. implementation 'androidx.navigation:navigation-ui:2.3.0'
  134. implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  135. testImplementation 'junit:junit:4.12'
  136. androidTestImplementation 'androidx.test.ext:junit:1.1.1'
  137. androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  138. implementation(name: 'frpclib', ext: 'aar')
  139. implementation 'androidx.recyclerview:recyclerview:1.1.0'
  140. implementation 'com.jakewharton:butterknife:10.2.1'
  141. annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
  142. implementation 'com.squareup.retrofit2:retrofit:2.6.2'
  143. implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
  144. implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
  145. implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
  146. implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
  147. implementation 'com.github.ahmadaghazadeh:CodeEditor:1.0.17'
  148. implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
  149. implementation 'org.jetbrains:annotations:15.0'
  150. implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
  151. implementation 'io.github.jeremyliao:live-event-bus-x:1.8.0'
  152. implementation 'com.google.android.material:material:1.5.0'
  153. implementation "androidx.multidex:multidex:2.0.1"
  154. def room_version = "2.4.1"
  155. implementation "androidx.room:room-runtime:$room_version"
  156. annotationProcessor "androidx.room:room-compiler:$room_version"
  157. implementation "androidx.room:room-rxjava2:$room_version"
  158. implementation 'com.blankj:utilcodex:1.30.6'
  159. implementation 'androidx.work:work-runtime:2.7.0'
  160. implementation 'org.xutils:xutils:3.9.0'
  161. implementation 'com.alibaba:fastjson:1.2.73'
  162. implementation 'com.github.sanyinchen:LogView:v1.0'
  163. def appCenterSdkVersion = '5.0.0'
  164. implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
  165. implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
  166. implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
  167. implementation project(':ussd-library')
  168. }