From 3da5a7979fcd6f838fab227930bb17511f8e1e85 Mon Sep 17 00:00:00 2001 From: Matthew Mitchell Date: Tue, 28 May 2024 21:46:28 +0100 Subject: [PATCH] Fix deprecated Android config --- coinlib_flutter/example/.metadata | 30 +++++++++++++++++++ .../example/android/app/build.gradle | 19 ++++-------- coinlib_flutter/example/android/build.gradle | 13 -------- .../example/android/settings.gradle | 30 ++++++++++++++----- coinlib_flutter/example/web/index.html | 25 ++-------------- 5 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 coinlib_flutter/example/.metadata diff --git a/coinlib_flutter/example/.metadata b/coinlib_flutter/example/.metadata new file mode 100644 index 0000000..784ce12 --- /dev/null +++ b/coinlib_flutter/example/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: web + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/coinlib_flutter/example/android/app/build.gradle b/coinlib_flutter/example/android/app/build.gradle index 751b721..527ae05 100644 --- a/coinlib_flutter/example/android/app/build.gradle +++ b/coinlib_flutter/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -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' @@ -21,10 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion @@ -64,7 +61,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/coinlib_flutter/example/android/build.gradle b/coinlib_flutter/example/android/build.gradle index 713d7f6..bc157bd 100644 --- a/coinlib_flutter/example/android/build.gradle +++ b/coinlib_flutter/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/coinlib_flutter/example/android/settings.gradle b/coinlib_flutter/example/android/settings.gradle index 44e62bc..8c04714 100644 --- a/coinlib_flutter/example/android/settings.gradle +++ b/coinlib_flutter/example/android/settings.gradle @@ -1,11 +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 localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.2.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" diff --git a/coinlib_flutter/example/web/index.html b/coinlib_flutter/example/web/index.html index a504d4b..bb95b6b 100644 --- a/coinlib_flutter/example/web/index.html +++ b/coinlib_flutter/example/web/index.html @@ -29,31 +29,10 @@ - coinlib_flutter_example + coinlib_flutter example - - - - - +