From 6819111886634965664b08b53d23fe139e2bcf06 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Sun, 20 Feb 2022 11:17:41 +0100 Subject: [PATCH] Update platform_design Android files (#1023) --- platform_design/android/.gitignore | 6 +++++ platform_design/android/app/build.gradle | 23 ++++++++++--------- .../android/app/src/main/AndroidManifest.xml | 18 +++++++++------ .../flutter/platform_design/MainActivity.kt | 6 ----- .../res/drawable-v21/launch_background.xml | 12 ++++++++++ .../app/src/main/res/values-night/styles.xml | 18 +++++++++++++++ .../app/src/main/res/values/styles.xml | 12 +++++++++- platform_design/android/build.gradle | 8 +++---- platform_design/android/gradle.properties | 1 - .../gradle/wrapper/gradle-wrapper.properties | 2 +- platform_design/android/settings.gradle | 18 ++++++--------- 11 files changed, 82 insertions(+), 42 deletions(-) create mode 100644 platform_design/android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 platform_design/android/app/src/main/res/values-night/styles.xml diff --git a/platform_design/android/.gitignore b/platform_design/android/.gitignore index bc2100d8f..6f568019d 100644 --- a/platform_design/android/.gitignore +++ b/platform_design/android/.gitignore @@ -5,3 +5,9 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/platform_design/android/app/build.gradle b/platform_design/android/app/build.gradle index 5078e6c17..dcd1edf7f 100644 --- a/platform_design/android/app/build.gradle +++ b/platform_design/android/app/build.gradle @@ -26,24 +26,28 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion flutter.compileSdkVersion - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' } - lintOptions { - disable 'InvalidPackage' + sourceSets { + main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "dev.flutter.platform_design" - minSdkVersion 16 - targetSdkVersion 28 + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -61,7 +65,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' } diff --git a/platform_design/android/app/src/main/AndroidManifest.xml b/platform_design/android/app/src/main/AndroidManifest.xml index fe2430e72..bccbe88c6 100644 --- a/platform_design/android/app/src/main/AndroidManifest.xml +++ b/platform_design/android/app/src/main/AndroidManifest.xml @@ -1,21 +1,25 @@ - - + + diff --git a/platform_design/android/app/src/main/kotlin/dev/flutter/platform_design/MainActivity.kt b/platform_design/android/app/src/main/kotlin/dev/flutter/platform_design/MainActivity.kt index 846f91321..372365b95 100644 --- a/platform_design/android/app/src/main/kotlin/dev/flutter/platform_design/MainActivity.kt +++ b/platform_design/android/app/src/main/kotlin/dev/flutter/platform_design/MainActivity.kt @@ -1,12 +1,6 @@ package dev.flutter.platform_design -import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } } diff --git a/platform_design/android/app/src/main/res/drawable-v21/launch_background.xml b/platform_design/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/platform_design/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/platform_design/android/app/src/main/res/values-night/styles.xml b/platform_design/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..3db14bb53 --- /dev/null +++ b/platform_design/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/platform_design/android/app/src/main/res/values/styles.xml b/platform_design/android/app/src/main/res/values/styles.xml index 00fa4417c..d460d1e92 100644 --- a/platform_design/android/app/src/main/res/values/styles.xml +++ b/platform_design/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/platform_design/android/build.gradle b/platform_design/android/build.gradle index 3100ad2d5..4256f9173 100644 --- a/platform_design/android/build.gradle +++ b/platform_design/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/platform_design/android/gradle.properties b/platform_design/android/gradle.properties index 38c8d4544..94adc3a3f 100644 --- a/platform_design/android/gradle.properties +++ b/platform_design/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true diff --git a/platform_design/android/gradle/wrapper/gradle-wrapper.properties b/platform_design/android/gradle/wrapper/gradle-wrapper.properties index 296b146b7..bc6a58afd 100644 --- a/platform_design/android/gradle/wrapper/gradle-wrapper.properties +++ b/platform_design/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/platform_design/android/settings.gradle b/platform_design/android/settings.gradle index 5a2f14fb1..44e62bcf0 100644 --- a/platform_design/android/settings.gradle +++ b/platform_design/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +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"