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+ id " dev.flutter.flutter-gradle-plugin"
225}
236
24- apply plugin : ' com.android.application'
25- apply plugin : ' kotlin-android'
26- apply from : " $flutterRoot /packages/flutter_tools/gradle/flutter.gradle"
27-
287android {
8+ namespace " com.example.fresh_example"
299 // Any value starting with "flutter." get its value from
3010 // the Flutter Gradle plugin.
3111 compileSdk flutter. compileSdkVersion
3212
13+ compileOptions {
14+ sourceCompatibility JavaVersion . VERSION_17
15+ targetCompatibility JavaVersion . VERSION_17
16+ }
17+
18+ kotlinOptions {
19+ jvmTarget = ' 17'
20+ }
3321 sourceSets {
3422 main. java. srcDirs + = ' src/main/kotlin'
3523 }
@@ -38,11 +26,11 @@ android {
3826 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3927 applicationId " com.example.fresh_example"
4028 // You can update the following value to match your application needs.
41- minSdkVersion flutter. minSdkVersion
42- targetSdkVersion flutter. targetSdkVersion
29+ minSdk flutter. minSdkVersion
30+ targetSdk flutter. targetSdkVersion
4331 // You can set these values in the property declaration or use a variable
44- versionCode flutterVersionCode . toInteger()
45- versionName flutterVersionName
32+ versionCode flutter . versionCode . toInteger()
33+ versionName flutter . versionName
4634 }
4735
4836 buildTypes {
@@ -57,7 +45,3 @@ android {
5745flutter {
5846 source ' ../..'
5947}
60-
61- dependencies {
62- implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version "
63- }
0 commit comments