1
1
def localProperties = new Properties ()
2
2
def localPropertiesFile = rootProject. file(' local.properties' )
3
3
if (localPropertiesFile. exists()) {
4
- localPropertiesFile. withInputStream { stream ->
5
- localProperties. load(stream )
4
+ localPropertiesFile. withReader( ' UTF-8 ' ) { reader ->
5
+ localProperties. load(reader )
6
6
}
7
7
}
8
8
@@ -11,24 +11,32 @@ if (flutterRoot == null) {
11
11
throw new GradleException (" Flutter SDK not found. Define location with flutter.sdk in the local.properties file." )
12
12
}
13
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
+
14
24
apply plugin : ' com.android.application'
15
25
apply from : " $flutterRoot /packages/flutter_tools/gradle/flutter.gradle"
16
26
17
27
android {
18
- compileSdkVersion 25
19
- buildToolsVersion ' 25.0.3'
28
+ compileSdkVersion 28
20
29
21
30
lintOptions {
22
31
disable ' InvalidPackage'
23
32
}
24
33
25
34
defaultConfig {
26
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
27
35
applicationId " flutter.plugins.screen.screenexample"
28
36
minSdkVersion 16
29
- targetSdkVersion 25
30
- versionCode 1
31
- versionName " 1.0 "
37
+ targetSdkVersion 28
38
+ versionCode flutterVersionCode . toInteger()
39
+ versionName flutterVersionName
32
40
testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
33
41
}
34
42
@@ -46,7 +54,7 @@ flutter {
46
54
}
47
55
48
56
dependencies {
49
- androidTestCompile ' com.android.support:support-annotations:25.4.0 '
50
- androidTestCompile ' com.android.support.test:runner:0.5 '
51
- androidTestCompile ' com.android.support.test:rules:0.5 '
57
+ androidTestImplementation ' com.android.support:support-annotations:28.0.3 '
58
+ androidTestImplementation ' com.android.support.test:runner:1.0.2 '
59
+ androidTestImplementation ' com.android.support.test:rules:1.0.2 '
52
60
}
0 commit comments