|
| 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 | + |
| 9 | +def flutterRoot = localProperties.getProperty('flutter.sdk') |
| 10 | +if (flutterRoot == null) { |
| 11 | + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | +} |
| 13 | + |
| 14 | +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') |
| 15 | +if (flutterVersionCode == null) { |
| 16 | + flutterVersionCode = '1' |
| 17 | +} |
| 18 | + |
| 19 | +def flutterVersionName = localProperties.getProperty('flutter.versionName') |
| 20 | +if (flutterVersionName == null) { |
| 21 | + flutterVersionName = '1.0' |
| 22 | +} |
| 23 | + |
| 24 | +apply plugin: 'com.android.application' |
| 25 | +apply plugin: 'kotlin-android' |
| 26 | +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
| 27 | + |
| 28 | +android { |
| 29 | + compileSdkVersion flutter.compileSdkVersion |
| 30 | + ndkVersion flutter.ndkVersion |
| 31 | + |
| 32 | + compileOptions { |
| 33 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 34 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 35 | + } |
| 36 | + |
| 37 | + kotlinOptions { |
| 38 | + jvmTarget = '1.8' |
| 39 | + } |
| 40 | + |
| 41 | + sourceSets { |
| 42 | + main.java.srcDirs += 'src/main/kotlin' |
| 43 | + } |
| 44 | + |
| 45 | + defaultConfig { |
| 46 | + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
| 47 | + applicationId "com.example.music_player" |
| 48 | + // You can update the following values to match your application needs. |
| 49 | + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. |
| 50 | + minSdkVersion 21 |
| 51 | + targetSdkVersion flutter.targetSdkVersion |
| 52 | + versionCode flutterVersionCode.toInteger() |
| 53 | + versionName flutterVersionName |
| 54 | + } |
| 55 | + |
| 56 | + buildTypes { |
| 57 | + release { |
| 58 | + // TODO: Add your own signing config for the release build. |
| 59 | + // Signing with the debug keys for now, so `flutter run --release` works. |
| 60 | + signingConfig signingConfigs.debug |
| 61 | + } |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +flutter { |
| 66 | + source '../..' |
| 67 | +} |
| 68 | + |
| 69 | +dependencies { |
| 70 | + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 71 | +} |
0 commit comments