|
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' |
| 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" |
17 | 6 | }
|
18 | 7 |
|
19 |
| -def flutterVersionName = localProperties.getProperty('flutter.versionName') |
20 |
| -if (flutterVersionName == null) { |
21 |
| - flutterVersionName = '1.0' |
22 |
| -} |
| 8 | +android { |
| 9 | + namespace = "cn.flutter.dio_flutter_example" |
| 10 | + compileSdk = flutter.compileSdkVersion |
| 11 | + ndkVersion = flutter.ndkVersion |
23 | 12 |
|
24 |
| -apply plugin: 'com.android.application' |
25 |
| -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
| 13 | + compileOptions { |
| 14 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 15 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 16 | + } |
26 | 17 |
|
27 |
| -android { |
28 |
| - compileSdkVersion flutter.compileSdkVersion |
| 18 | + kotlinOptions { |
| 19 | + jvmTarget = JavaVersion.VERSION_1_8 |
| 20 | + } |
29 | 21 |
|
30 | 22 | defaultConfig {
|
31 |
| - applicationId "com.example.flutterApp" |
32 |
| - minSdkVersion flutter.minSdkVersion |
33 |
| - targetSdkVersion flutter.targetSdkVersion |
34 |
| - versionCode flutterVersionCode.toInteger() |
35 |
| - versionName flutterVersionName |
| 23 | + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
| 24 | + applicationId = "cn.flutter.dio_flutter_example" |
| 25 | + // You can update the following values to match your application needs. |
| 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 |
36 | 31 | }
|
37 | 32 |
|
38 | 33 | buildTypes {
|
39 | 34 | release {
|
40 | 35 | // TODO: Add your own signing config for the release build.
|
41 | 36 | // Signing with the debug keys for now, so `flutter run --release` works.
|
42 |
| - signingConfig signingConfigs.debug |
| 37 | + signingConfig = signingConfigs.debug |
43 | 38 | }
|
44 | 39 | }
|
45 | 40 | }
|
46 | 41 |
|
47 | 42 | flutter {
|
48 |
| - source '../..' |
| 43 | + source = "../.." |
49 | 44 | }
|
0 commit comments