@@ -2,43 +2,50 @@ plugins {
22 id " com.android.application"
33 id " kotlin-android"
44 id " kotlin-kapt"
5+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
56 id " dev.flutter.flutter-gradle-plugin"
67}
78
8- def localProperties = new Properties ()
9- def localPropertiesFile = rootProject. file(' local.properties' )
10- if (localPropertiesFile. exists()) {
11- localPropertiesFile. withReader(' UTF-8' ) { reader ->
12- localProperties. load(reader)
13- }
9+ def flutterVersionCode = null
10+ def flutterVersionName = null
11+ if (flutter. hasProperty(' versionCode' )) {
12+ flutterVersionCode = flutter. versionCode
1413}
15-
16- def flutterVersionCode = localProperties. getProperty(' flutter.versionCode' )
17- if (flutterVersionCode == null ) {
18- flutterVersionCode = ' 1'
14+ if (flutter. hasProperty(' versionName' )) {
15+ flutterVersionName = flutter. versionName
1916}
2017
21- def flutterVersionName = localProperties. getProperty(' flutter.versionName' )
22- if (flutterVersionName == null ) {
23- flutterVersionName = ' 1.0'
18+ if (flutterVersionCode == null || flutterVersionName == null ) {
19+ def localProperties = new Properties ()
20+ rootProject. file(' local.properties' ). withReader(' UTF-8' ) { reader ->
21+ localProperties. load(reader)
22+ }
23+
24+ if (flutterVersionCode == null ) {
25+ flutterVersionCode = localProperties. getProperty(' flutter.versionCode' )
26+ }
27+ if (flutterVersionName == null ) {
28+ flutterVersionName = localProperties. getProperty(' flutter.versionName' )
29+ }
2430}
2531
2632android {
2733 namespace " com.fluttercandies.wechatAssetsPickerExample"
2834 compileSdk flutter. compileSdkVersion
29-
30- sourceSets {
31- main. java. srcDirs + = ' src/main/kotlin'
32- }
35+ ndkVersion flutter. ndkVersion
3336
3437 defaultConfig {
35- applicationId " com.fluttercandies.wechatAssetsPickerExample"
36- minSdkVersion 21
37- targetSdkVersion flutter. targetSdkVersion
38+ applicationId = " com.fluttercandies.wechatAssetsPickerExample"
39+ minSdk 21
40+ targetSdk flutter. targetSdkVersion
3841 versionCode flutterVersionCode. toInteger()
3942 versionName flutterVersionName
4043 }
4144
45+ sourceSets {
46+ main. java. srcDirs + = ' src/main/kotlin'
47+ }
48+
4249 kotlinOptions {
4350 jvmTarget = ' 17'
4451 }
0 commit comments