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