Skip to content

Commit e55ddf2

Browse files
committed
upgrading flutter foreground service example app
1 parent 49c2532 commit e55ddf2

File tree

5 files changed

+37
-39
lines changed

5 files changed

+37
-39
lines changed

packages/flutter_foreground_service/example/android/app/build.gradle

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ if (localPropertiesFile.exists()) {
66
}
77
}
88

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-
}
13-
149
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1510
if (flutterVersionCode == null) {
1611
flutterVersionCode = '1'
@@ -21,13 +16,19 @@ if (flutterVersionName == null) {
2116
flutterVersionName = '1.0'
2217
}
2318

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2819
android {
29-
compileSdkVersion 33
20+
namespace "dk.cachet.flutter_foreground_service_example"
21+
testNamespace "dk.cachet.flutter_foreground_service_example.test"
22+
compileSdkVersion 35
3023

24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
28+
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
3132

3233
sourceSets {
3334
main.java.srcDirs += 'src/main/kotlin'
@@ -41,7 +42,7 @@ android {
4142
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4243
applicationId "dk.cachet.flutter_foreground_service_example"
4344
minSdkVersion 23
44-
targetSdkVersion 33
45+
targetSdkVersion flutter.targetSdkVersion
4546
versionCode flutterVersionCode.toInteger()
4647
versionName flutterVersionName
4748
}
@@ -59,6 +60,4 @@ flutter {
5960
source '../..'
6061
}
6162

62-
dependencies {
63-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64-
}
63+
dependencies {}

packages/flutter_foreground_service/example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dk.cachet.flutter_foreground_service_example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- Flutter needs it to communicate with the running application
43
to allow setting breakpoints, to provide hot reload, etc.
54
-->

packages/flutter_foreground_service/example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dk.cachet.flutter_foreground_service_example">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
43
calls FlutterMain.startInitialization(this); in its onCreate method.
54
In most cases you can leave this as-is, but you if you want to provide

packages/flutter_foreground_service/example/android/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.3.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.2"
21+
id "com.android.application" version '8.9.0' apply false
22+
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
23+
}
24+
25+
include ":app"

0 commit comments

Comments
 (0)