build.gradle 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. group = "com.atmob.flutter_tool_android"
  2. version = "1.0"
  3. buildscript {
  4. repositories {
  5. google()
  6. mavenCentral()
  7. }
  8. dependencies {
  9. classpath("com.android.tools.build:gradle:7.3.0")
  10. }
  11. }
  12. rootProject.allprojects {
  13. repositories {
  14. google()
  15. mavenCentral()
  16. }
  17. }
  18. // 加载 local.properties 文件
  19. def localProperties = new Properties()
  20. def localPropertiesFile = rootProject.file('local.properties')
  21. if (localPropertiesFile.exists()) {
  22. localPropertiesFile.withInputStream { stream ->
  23. localProperties.load(stream)
  24. }
  25. }
  26. // 读取变量
  27. def flutterSdk = localProperties.getProperty('flutter.sdk')
  28. apply plugin: "com.android.library"
  29. android {
  30. if (project.android.hasProperty("namespace")) {
  31. namespace = "com.atmob.flutter_tool_android"
  32. }
  33. compileSdk = 34
  34. compileOptions {
  35. sourceCompatibility = JavaVersion.VERSION_1_8
  36. targetCompatibility = JavaVersion.VERSION_1_8
  37. }
  38. defaultConfig {
  39. minSdk = 21
  40. }
  41. dependencies {
  42. //flutter
  43. compileOnly files("$flutterSdk/bin/cache/artifacts/engine/android-arm/flutter.jar")
  44. //AndroidX
  45. compileOnly "androidx.annotation:annotation:1.1.0"
  46. }
  47. testOptions {
  48. unitTests.all {
  49. testLogging {
  50. events "passed", "skipped", "failed", "standardOut", "standardError"
  51. outputs.upToDateWhen { false }
  52. showStandardStreams = true
  53. }
  54. }
  55. }
  56. }