From 6f14f2dbd4ec1b1bbf4030dbdcd073bad6568f6a Mon Sep 17 00:00:00 2001 From: Nils Reichardt Date: Fri, 20 Dec 2024 19:17:26 +0100 Subject: [PATCH] chore(app_preview_example): re-create /android folder with Flutter 3.27 (#113) Fixes the build erros. --- packages/app_preview_example/.metadata | 16 +-- .../app_preview_example/android/.gitignore | 2 +- .../android/app/build.gradle | 65 +++------ .../android/app/src/debug/AndroidManifest.xml | 3 +- .../android/app/src/main/AndroidManifest.xml | 17 ++- .../app_preview_example/MainActivity.kt | 5 + .../app_preview_example/MainActivity.kt | 6 - .../app/src/profile/AndroidManifest.xml | 3 +- .../app_preview_example/android/build.gradle | 19 +-- .../android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 3 +- .../android/settings.gradle | 30 ++-- packages/app_preview_example/lib/main.dart | 2 +- packages/app_preview_example/pubspec.lock | 132 ++++++++++++------ 14 files changed, 165 insertions(+), 140 deletions(-) create mode 100644 packages/app_preview_example/android/app/src/main/kotlin/io/nilsreichardt/app_preview_example/MainActivity.kt delete mode 100644 packages/app_preview_example/android/app/src/main/kotlin/io/reichardt/app_preview_example/MainActivity.kt diff --git a/packages/app_preview_example/.metadata b/packages/app_preview_example/.metadata index 009d4c1..8af9f15 100644 --- a/packages/app_preview_example/.metadata +++ b/packages/app_preview_example/.metadata @@ -1,11 +1,11 @@ # 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. +# This file should be version controlled and should not be manually edited. version: - revision: 85684f9300908116a78138ea4c6036c35c9a1236 - channel: stable + revision: "17025dd88227cd9532c33fa78f5250d548d87e9a" + channel: "stable" project_type: app @@ -13,11 +13,11 @@ project_type: app migration: platforms: - platform: root - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - - platform: ios - create_revision: 85684f9300908116a78138ea4c6036c35c9a1236 - base_revision: 85684f9300908116a78138ea4c6036c35c9a1236 + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + - platform: android + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a # User provided section diff --git a/packages/app_preview_example/android/.gitignore b/packages/app_preview_example/android/.gitignore index 6f56801..55afd91 100644 --- a/packages/app_preview_example/android/.gitignore +++ b/packages/app_preview_example/android/.gitignore @@ -7,7 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/packages/app_preview_example/android/app/build.gradle b/packages/app_preview_example/android/app/build.gradle index c405c22..c70cafd 100644 --- a/packages/app_preview_example/android/app/build.gradle +++ b/packages/app_preview_example/android/app/build.gradle @@ -1,71 +1,44 @@ -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' +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" } -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 + namespace = "io.nilsreichardt.app_preview_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "io.reichardt.app_preview_example" + applicationId = "io.nilsreichardt.app_preview_example" // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } 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 + signingConfig = signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + source = "../.." } diff --git a/packages/app_preview_example/android/app/src/debug/AndroidManifest.xml b/packages/app_preview_example/android/app/src/debug/AndroidManifest.xml index b450fae..399f698 100644 --- a/packages/app_preview_example/android/app/src/debug/AndroidManifest.xml +++ b/packages/app_preview_example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + + + + + + diff --git a/packages/app_preview_example/android/app/src/main/kotlin/io/nilsreichardt/app_preview_example/MainActivity.kt b/packages/app_preview_example/android/app/src/main/kotlin/io/nilsreichardt/app_preview_example/MainActivity.kt new file mode 100644 index 0000000..b5fc38c --- /dev/null +++ b/packages/app_preview_example/android/app/src/main/kotlin/io/nilsreichardt/app_preview_example/MainActivity.kt @@ -0,0 +1,5 @@ +package io.nilsreichardt.app_preview_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/packages/app_preview_example/android/app/src/main/kotlin/io/reichardt/app_preview_example/MainActivity.kt b/packages/app_preview_example/android/app/src/main/kotlin/io/reichardt/app_preview_example/MainActivity.kt deleted file mode 100644 index f0d2b00..0000000 --- a/packages/app_preview_example/android/app/src/main/kotlin/io/reichardt/app_preview_example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package io.reichardt.app_preview_example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/packages/app_preview_example/android/app/src/profile/AndroidManifest.xml b/packages/app_preview_example/android/app/src/profile/AndroidManifest.xml index b450fae..399f698 100644 --- a/packages/app_preview_example/android/app/src/profile/AndroidManifest.xml +++ b/packages/app_preview_example/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - +