build.gradle 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. group 'com.pauldemarco.flutter_blue'
  2. version '1.0'
  3. def localProperties = new Properties()
  4. def localPropertiesFile = rootProject.file('local.properties')
  5. if (localPropertiesFile.exists()) {
  6. localPropertiesFile.withReader('UTF-8') { reader ->
  7. localProperties.load(reader)
  8. }
  9. }
  10. def flutterRoot = localProperties.getProperty('flutter.sdk')
  11. if (flutterRoot == null) {
  12. throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  13. }
  14. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  15. if (flutterVersionCode == null) {
  16. flutterVersionCode = '1'
  17. }
  18. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  19. if (flutterVersionName == null) {
  20. flutterVersionName = '1.0'
  21. }
  22. buildscript {
  23. repositories {
  24. google()
  25. jcenter()
  26. }
  27. dependencies {
  28. classpath 'com.android.tools.build:gradle:4.1.0'
  29. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.15'
  30. }
  31. }
  32. rootProject.allprojects {
  33. repositories {
  34. google()
  35. jcenter()
  36. }
  37. }
  38. apply plugin: 'com.android.library'
  39. apply plugin: 'com.google.protobuf'
  40. android {
  41. compileSdkVersion 30
  42. defaultConfig {
  43. minSdkVersion 19
  44. }
  45. sourceSets {
  46. main {
  47. proto {
  48. srcDir '../protos'
  49. }
  50. }
  51. }
  52. }
  53. protobuf {
  54. protoc {
  55. artifact = 'com.google.protobuf:protoc:3.11.4'
  56. }
  57. generateProtoTasks {
  58. all().each { task ->
  59. task.builtins {
  60. java {
  61. option "lite"
  62. }
  63. }
  64. }
  65. }
  66. }
  67. dependencies {
  68. implementation 'com.google.protobuf:protobuf-javalite:3.11.4'
  69. compileOnly files("$flutterRoot/bin/cache/artifacts/engine/android-arm64/flutter.jar")
  70. compileOnly "androidx.annotation:annotation:1.1.0"
  71. compileOnly "androidx.appcompat:appcompat:1.3.0"
  72. }