build.gradle 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. buildscript
  2. {
  3. repositories
  4. {
  5. mavenCentral()
  6. google()
  7. }
  8. dependencies
  9. {
  10. // 4.1.2 is the minimum version to support native debug symbols file
  11. // https://developer.android.com/studio/build/shrink-code#android_gradle_plugin_version_41_or_later
  12. // 7.0.0 to fix https://stackoverflow.com/questions/68387270/android-studio-error-installed-build-tools-revision-31-0-0-is-corrupted
  13. classpath 'com.android.tools.build:gradle:8.2.1'
  14. }
  15. }
  16. allprojects
  17. {
  18. repositories
  19. {
  20. mavenCentral()
  21. google()
  22. }
  23. }
  24. apply plugin: 'com.android.application'
  25. android
  26. {
  27. // Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
  28. namespace project.getProperty('package_name')
  29. // buildToolsVersion is no longer needed https://developer.android.com/studio/releases/gradle-plugin.html#behavior_changes_1
  30. // Quote:
  31. // Build Tools 27.0.3 or higher. Keep in mind, you no longer need to specify a version for the build tools using the android.buildToolsVersion property—the plugin uses the minimum required version by default.
  32. compileSdkVersion compile_sdk_version.toInteger()
  33. ndkVersion ndk_version
  34. externalNativeBuild
  35. {
  36. ndkBuild
  37. {
  38. path 'Android.mk'
  39. }
  40. }
  41. defaultConfig
  42. {
  43. versionCode project.getProperty('version_code').toInteger()
  44. versionName project.getProperty('version_name')
  45. minSdkVersion min_sdk_version.toInteger()
  46. targetSdkVersion target_sdk_version.toInteger()
  47. externalNativeBuild
  48. {
  49. ndkBuild
  50. {
  51. def app_platform = "APP_PLATFORM=android-${min_sdk_version}"
  52. arguments app_platform, 'APP_STL=c++_static', cpu_core
  53. if (project.getProperty('compile_arch') == 'all')
  54. {
  55. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  56. }
  57. else
  58. {
  59. abiFilters project.getProperty('compile_arch')
  60. }
  61. }
  62. }
  63. def runTasks = gradle.startParameter.taskNames
  64. if ('bundleRelease' in runTasks)
  65. {
  66. // use SYMBOL_TABLE if too large later (max limit on google play is 300MB)
  67. ndk.debugSymbolLevel 'FULL'
  68. }
  69. }
  70. signingConfigs
  71. {
  72. release
  73. {
  74. storeFile file(keystore)
  75. storePassword storepass
  76. keyAlias alias
  77. keyPassword storepass
  78. }
  79. }
  80. buildTypes
  81. {
  82. debug
  83. {
  84. debuggable true
  85. jniDebuggable true
  86. minifyEnabled false
  87. shrinkResources false
  88. multiDexEnabled true
  89. externalNativeBuild
  90. {
  91. ndkBuild
  92. {
  93. arguments 'NDK_DEBUG=1'
  94. cFlags '-O0'
  95. cppFlags '-O0'
  96. }
  97. }
  98. ndk
  99. {
  100. if (project.getProperty('compile_arch') == 'all')
  101. {
  102. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  103. }
  104. else
  105. {
  106. abiFilters project.getProperty('compile_arch')
  107. }
  108. }
  109. }
  110. release
  111. {
  112. externalNativeBuild
  113. {
  114. ndkBuild
  115. {
  116. cFlags '-O3'
  117. cppFlags '-O3'
  118. }
  119. }
  120. signingConfig signingConfigs.release
  121. ndk
  122. {
  123. if (project.getProperty('compile_arch') == 'all')
  124. {
  125. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  126. }
  127. else
  128. {
  129. abiFilters project.getProperty('compile_arch')
  130. }
  131. }
  132. }
  133. }
  134. sourceSets
  135. {
  136. main
  137. {
  138. manifest.srcFile 'AndroidManifest.xml'
  139. res.srcDirs = ['res']
  140. assets.srcDirs = ['assets']
  141. }
  142. }
  143. }
  144. dependencies
  145. {
  146. implementation 'org.minidns:minidns-hla:0.3.3'
  147. }