diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index acaddc120..f3db1d019 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,67 +1,5 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'com.google.gms.google-services' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 34 - - // Require Java language level 8 so we can use Method References (used with Lambdas) - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - applicationId "io.ably.flutter.example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion 34 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' -} +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} \ No newline at end of file diff --git a/example/android/build.gradle b/example/android/build.gradle index 12fdcd8f9..9c14b3280 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,4 +1,5 @@ buildscript { + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() @@ -6,7 +7,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.4.0' - classpath 'com.google.gms:google-services:4.3.10' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -25,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 5a2f14fb1..964cd8332 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "{agpVersion}" apply false + id "org.jetbrains.kotlin.android" version "{kotlinVersion}" apply false } + +include ":app" \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index 23bf66c54..da27135ff 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -166,10 +166,10 @@ packages: dependency: "direct main" description: name: fluttertoast - sha256: "963249d47b24190b03a073d784c4d4a07030d290fbace972f44a7a05fd120027" + sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc" url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "8.2.8" http: dependency: "direct main" description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ceb8c378c..27fdb9e3f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: stream_transform: ^2.0.0 enum_to_string: ^2.0.1 flutter_local_notifications: ^17.2.3 - fluttertoast: 8.0.2 + fluttertoast: ^8.2.8 device_info_plus: ^10.1.2 crypto: ^3.0.1 flutter_hooks: ^0.18.2