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