1
- plugins {
2
- id " com.android.application"
3
- id " kotlin-android"
4
- // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5
- id " dev.flutter.flutter-gradle-plugin"
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
+ }
6
7
}
7
8
8
- android {
9
- namespace " io.openinstall.openinstall_flutter_plugin_example "
10
- compileSdk = flutter. compileSdkVersion
11
- ndkVersion = flutter . ndkVersion
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
+ }
12
13
13
- lintOptions {
14
- disable ' InvalidPackage'
15
- }
14
+ def flutterVersionCode = localProperties. getProperty(' flutter.versionCode' )
15
+ if (flutterVersionCode == null ) {
16
+ flutterVersionCode = ' 1'
17
+ }
16
18
17
- kotlinOptions {
18
- jvmTarget = JavaVersion . VERSION_1_8
19
- }
19
+ def flutterVersionName = localProperties. getProperty(' flutter.versionName' )
20
+ if (flutterVersionName == null ) {
21
+ flutterVersionName = ' 1.0'
22
+ }
23
+
24
+ apply plugin : ' com.android.application'
25
+ apply plugin : ' kotlin-android'
26
+ apply from : " $flutterRoot /packages/flutter_tools/gradle/flutter.gradle"
27
+
28
+ android {
29
+ compileSdkVersion flutter. compileSdkVersion
30
+ ndkVersion flutter. ndkVersion
20
31
21
32
compileOptions {
22
33
sourceCompatibility JavaVersion . VERSION_1_8
23
34
targetCompatibility JavaVersion . VERSION_1_8
24
35
}
25
36
37
+ kotlinOptions {
38
+ jvmTarget = ' 1.8'
39
+ }
40
+
41
+ sourceSets {
42
+ main. java. srcDirs + = ' src/main/kotlin'
43
+ }
26
44
defaultConfig {
27
45
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
28
46
applicationId " io.openinstall.openinstall_flutter_plugin_example"
29
-
30
47
// You can update the following values to match your application needs.
31
- // For more information, see: https://flutter.dev/to/review- gradle-config .
32
- minSdk = flutter. minSdkVersion
33
- targetSdk = flutter. targetSdkVersion
34
- versionCode = flutter . versionCode
35
- versionName = flutter . versionName
48
+ // For more information, see: https://docs. flutter.dev/deployment/android#reviewing-the- gradle-build-configuration .
49
+ minSdkVersion flutter. minSdkVersion
50
+ targetSdkVersion flutter. targetSdkVersion
51
+ versionCode flutterVersionCode . toInteger()
52
+ versionName flutterVersionName
36
53
37
54
manifestPlaceholders = [
38
55
OPENINSTALL_APPKEY : " ufp21n" ,
39
56
]
40
-
41
57
}
42
58
43
59
buildTypes {
@@ -53,3 +69,8 @@ flutter {
53
69
source ' ../..'
54
70
}
55
71
72
+ dependencies {
73
+ implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version "
74
+ }
75
+
76
+
0 commit comments