build.gradle 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. def localProperties = new Properties()
  2. def localPropertiesFile = rootProject.file('local.properties')
  3. if (localPropertiesFile.exists()) {
  4. localPropertiesFile.withReader('UTF-8') { reader ->
  5. localProperties.load(reader)
  6. }
  7. }
  8. def flutterRoot = localProperties.getProperty('flutter.sdk')
  9. if (flutterRoot == null) {
  10. throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  11. }
  12. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  13. if (flutterVersionCode == null) {
  14. flutterVersionCode = '1'
  15. }
  16. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  17. if (flutterVersionName == null) {
  18. flutterVersionName = '1.0'
  19. }
  20. apply plugin: 'com.android.application'
  21. apply plugin: 'kotlin-android'
  22. apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
  23. android {
  24. compileSdkVersion 33
  25. sourceSets {
  26. main.java.srcDirs += 'src/main/kotlin'
  27. }
  28. defaultConfig {
  29. // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
  30. applicationId "com.example.shuqi"
  31. minSdkVersion 21
  32. targetSdkVersion 33
  33. versionCode flutterVersionCode.toInteger()
  34. versionName flutterVersionName
  35. }
  36. buildTypes {
  37. release {
  38. // TODO: Add your own signing config for the release build.
  39. // Signing with the debug keys for now, so `flutter run --release` works.
  40. signingConfig signingConfigs.debug
  41. }
  42. }
  43. }
  44. flutter {
  45. source '../..'
  46. }
  47. // 指定版本,解决stdlib冲突问题
  48. dependencies {
  49. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  50. implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
  51. }