@@ -2,43 +2,50 @@ plugins {
2
2
id " com.android.application"
3
3
id " kotlin-android"
4
4
id " kotlin-kapt"
5
+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5
6
id " dev.flutter.flutter-gradle-plugin"
6
7
}
7
8
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
14
13
}
15
-
16
- def flutterVersionCode = localProperties. getProperty(' flutter.versionCode' )
17
- if (flutterVersionCode == null ) {
18
- flutterVersionCode = ' 1'
14
+ if (flutter. hasProperty(' versionName' )) {
15
+ flutterVersionName = flutter. versionName
19
16
}
20
17
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
+ }
24
30
}
25
31
26
32
android {
27
33
namespace " com.fluttercandies.wechatAssetsPickerExample"
28
34
compileSdk flutter. compileSdkVersion
29
-
30
- sourceSets {
31
- main. java. srcDirs + = ' src/main/kotlin'
32
- }
35
+ ndkVersion flutter. ndkVersion
33
36
34
37
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
38
41
versionCode flutterVersionCode. toInteger()
39
42
versionName flutterVersionName
40
43
}
41
44
45
+ sourceSets {
46
+ main. java. srcDirs + = ' src/main/kotlin'
47
+ }
48
+
42
49
kotlinOptions {
43
50
jvmTarget = ' 17'
44
51
}
0 commit comments