|
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' |
| 1 | +plugins { |
| 2 | + id "com.android.application" |
| 3 | + id "kotlin-android" |
| 4 | + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. |
| 5 | + id "dev.flutter.flutter-gradle-plugin" |
22 | 6 | } |
23 | 7 |
|
24 | | -apply plugin: 'com.android.application' |
25 | | -apply plugin: 'kotlin-android' |
26 | | -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
27 | | - |
28 | 8 | android { |
29 | | - compileSdkVersion flutter.compileSdkVersion |
30 | | - ndkVersion flutter.ndkVersion |
| 9 | + namespace = "com.example.example" |
| 10 | + compileSdk = flutter.compileSdkVersion |
| 11 | + ndkVersion = flutter.ndkVersion |
31 | 12 |
|
32 | 13 | compileOptions { |
33 | | - sourceCompatibility JavaVersion.VERSION_1_8 |
34 | | - targetCompatibility JavaVersion.VERSION_1_8 |
| 14 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 15 | + targetCompatibility = JavaVersion.VERSION_1_8 |
35 | 16 | } |
36 | 17 |
|
37 | 18 | kotlinOptions { |
38 | | - jvmTarget = '1.8' |
39 | | - } |
40 | | - |
41 | | - sourceSets { |
42 | | - main.java.srcDirs += 'src/main/kotlin' |
| 19 | + jvmTarget = JavaVersion.VERSION_1_8 |
43 | 20 | } |
44 | 21 |
|
45 | 22 | defaultConfig { |
46 | 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
47 | | - applicationId "com.example.example" |
| 24 | + applicationId = "com.example.example" |
48 | 25 | // 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 flutter.minSdkVersion |
51 | | - targetSdkVersion flutter.targetSdkVersion |
52 | | - versionCode flutterVersionCode.toInteger() |
53 | | - versionName flutterVersionName |
| 26 | + // For more information, see: https://flutter.dev/to/review-gradle-config. |
| 27 | + minSdk = flutter.minSdkVersion |
| 28 | + targetSdk = flutter.targetSdkVersion |
| 29 | + versionCode = flutter.versionCode |
| 30 | + versionName = flutter.versionName |
54 | 31 | } |
55 | 32 |
|
56 | 33 | buildTypes { |
57 | 34 | release { |
58 | 35 | // TODO: Add your own signing config for the release build. |
59 | 36 | // Signing with the debug keys for now, so `flutter run --release` works. |
60 | | - signingConfig signingConfigs.debug |
| 37 | + signingConfig = signingConfigs.debug |
61 | 38 | } |
62 | 39 | } |
63 | 40 | } |
64 | 41 |
|
65 | 42 | flutter { |
66 | | - source '../..' |
67 | | -} |
68 | | - |
69 | | -dependencies { |
70 | | - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 43 | + source = "../.." |
71 | 44 | } |
0 commit comments