|
| 1 | +def localProperties=newProperties() |
| 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 | +thrownewGradleException("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' |
| 22 | +} |
| 23 | + |
| 24 | +applyplugin:'com.android.application' |
| 25 | +applyplugin:'kotlin-android' |
| 26 | +applyfrom:"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
| 27 | + |
| 28 | +android { |
| 29 | + compileSdkVersion 33 |
| 30 | + ndkVersion flutter.ndkVersion |
| 31 | + |
| 32 | + compileOptions { |
| 33 | + sourceCompatibilityJavaVersion.VERSION_1_8 |
| 34 | + targetCompatibilityJavaVersion.VERSION_1_8 |
| 35 | + } |
| 36 | + |
| 37 | + kotlinOptions { |
| 38 | + jvmTarget='1.8' |
| 39 | + } |
| 40 | + |
| 41 | + sourceSets { |
| 42 | + main.java.srcDirs+='src/main/kotlin' |
| 43 | + } |
| 44 | + |
| 45 | + defaultConfig { |
| 46 | +// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
| 47 | + applicationId"com.example.flutter_ui_source" |
| 48 | +// 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 | + minSdkVersion20 |
| 51 | + targetSdkVersion flutter.targetSdkVersion |
| 52 | + versionCode flutterVersionCode.toInteger() |
| 53 | + versionName flutterVersionName |
| 54 | + } |
| 55 | + |
| 56 | + buildTypes { |
| 57 | + release { |
| 58 | +// TODO: Add your own signing config for the release build. |
| 59 | +// Signing with the debug keys for now, so `flutter run --release` works. |
| 60 | + signingConfig signingConfigs.debug |
| 61 | + } |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +flutter { |
| 66 | + source'../..' |
| 67 | +} |
| 68 | + |
| 69 | +dependencies { |
| 70 | + implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 71 | +} |