Skip to content

Commit

Permalink
- Modify the gradle configuration structure to match Flutter > 3.19 f…
Browse files Browse the repository at this point in the history
…or subsequent upgrades

- https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
- Update JDK and Gradle Plugin dependencies
- Update lib dependencies
- Update the codemagic script
- Change version 2.1.0
- Other documents
  • Loading branch information
einsitang committed Aug 25, 2024
1 parent b9e5281 commit 355df1c
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 80 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ about contributing please read [CONTRIBUTING.md](CONTRIBUTING.md)
## environment
- dart SDK: '>=3.0.0 <3.5.0' // records feature support
- flutter SDK: '^3.0.0'
- jdk 11
- jdk 17 with Gradle Plugin 8.1.1 :new:

## dependency
- [opencv_dart](https://github.com/rainyl/opencv_dart)
Expand Down
28 changes: 10 additions & 18 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
id "org.jetbrains.kotlin.android"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
Expand All @@ -7,10 +14,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) {
Expand All @@ -22,22 +25,14 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.sevlow.app.sudoku"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

sourceSets {
Expand Down Expand Up @@ -98,6 +93,3 @@ flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
16 changes: 15 additions & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class io.flutter.plugins.** { *; }

-dontwarn com.google.android.play.core.splitcompat.SplitCompatApplication
-dontwarn com.google.android.play.core.splitinstall.SplitInstallException
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManager
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManagerFactory
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest$Builder
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest
-dontwarn com.google.android.play.core.splitinstall.SplitInstallSessionState
-dontwarn com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener
-dontwarn com.google.android.play.core.tasks.OnFailureListener
-dontwarn com.google.android.play.core.tasks.OnSuccessListener
-dontwarn com.google.android.play.core.tasks.Task
-dontwarn org.tensorflow.lite.gpu.GpuDelegateFactory$Options$GpuBackend
-dontwarn org.tensorflow.lite.gpu.GpuDelegateFactory$Options
20 changes: 0 additions & 20 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
buildscript {
// ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:perf-plugin:1.4.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
// END: FlutterFire Configuration
// classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx2048M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
Expand Down
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
34 changes: 23 additions & 11 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
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
}()

include ':app'
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
id "com.google.gms.google-services" version "4.4.0" apply false
id "com.google.firebase.crashlytics" version "2.9.9" apply false
}

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"
include ':app'
4 changes: 2 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workflows:
sudoku-flutter-workflow:
environment:
java: 11
java: 17
flutter: 3.22.3
android_signing:
- ANDROID_KEYJKS
Expand All @@ -10,7 +10,7 @@ workflows:
scripts:
- name: build apk with flutter
script: |
flutter pub get
export OPENCV_DART_ANDROID_ENABLED_ABI="arm64-v8a,armeabi-v7a"
flutter build apk --release --target-platform=android-arm,android-arm64
Expand Down
35 changes: 18 additions & 17 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ packages:
dependency: "direct main"
description:
name: camera
sha256: "26ff41045772153f222ffffecba711a206f670f5834d40ebf5eed3811692f167"
sha256: "2170a943dcb67be2af2c6bcda8775e74b41d4c02d6a4eb10bdc832ee185c4eea"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.0+2"
version: "0.11.0+1"
camera_android_camerax:
dependency: transitive
dependency: "direct main"
description:
name: camera_android_camerax
sha256: "8bd9cab67551642eb33ceb33ece7acc0890014fc90ddfae637c7e2b683657e65"
Expand Down Expand Up @@ -229,10 +229,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.3"
version: "3.0.5"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -383,10 +383,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "9d98bd47ef9d34e803d438f17fd32b116d31009f534a6fa5ce3a1167f189a6de"
sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.21"
version: "2.0.22"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -489,10 +489,10 @@ packages:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.7"
version: "0.7.1"
json_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -608,10 +608,11 @@ packages:
opencv_dart:
dependency: "direct main"
description:
name: opencv_dart
sha256: b45d822988a852ba9c58f092b8003720c13a0bc98906803173a880f06205980b
url: "https://pub.flutter-io.cn"
source: hosted
path: "."
ref: "452994e8868b4d1f547d515cb89b53f0037840ec"
resolved-ref: "452994e8868b4d1f547d515cb89b53f0037840ec"
url: "https://github.com/einsitang/opencv_dart.git"
source: git
version: "1.2.2"
package_config:
dependency: transitive
Expand Down Expand Up @@ -641,10 +642,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb"
sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.9"
version: "2.2.10"
path_provider_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -894,10 +895,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: "94d8ad05f44c6d4e2ffe5567ab4d741b82d62e3c8e288cc1fcea45965edf47c9"
sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.3.8"
version: "6.3.9"
url_launcher_ios:
dependency: transitive
description:
Expand Down
17 changes: 9 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.0.1+1
version: 2.1.0+1

environment:
sdk: '>=3.0.0 <3.5.0'
Expand Down Expand Up @@ -45,17 +45,18 @@ dependencies:
cupertino_icons: ^1.0.5
url_launcher: ^6.1.7
just_audio: ^0.9.39
camera: ^0.11.0+1
camera_android_camerax: 0.6.7+2
camera: 0.11.0+1
path_provider: ^2.1.3
path: ^1.9.0
image: ^4.2.0
yaml: ^3.1.2
tflite_flutter: ^0.10.4
opencv_dart: ^1.2.2
# opencv_dart:
# git:
# url: https://github.com/einsitang/opencv_dart.git
# ref: 47a80d918a466e4317232b12b225cefcf7f20e6e
tflite_flutter: 0.10.4
# opencv_dart: 1.2.2
opencv_dart:
git:
url: https://github.com/einsitang/opencv_dart.git
ref: 452994e8868b4d1f547d515cb89b53f0037840ec
firebase_core: ^3.3.0
firebase_crashlytics: ^4.0.4
firebase_analytics: ^11.2.1
Expand Down

0 comments on commit 355df1c

Please sign in to comment.