fix: Resolve Dart type inference errors and update Android build configuration for Gradle 8.14
Type Annotation Fixes:
- fireNotificationList.dart: Added DeleteFireNotificationFunction and TapFireNotificationFunction types to _buildRow and _buildSavedFireNotifications parameters
- homePage.dart: Added Object type to catchError handler parameters
- redux/appReducer.dart: Added dynamic type annotation to action parameter
- redux/fetchDataMiddleware.dart: Added explicit type annotations and improved type casting
- redux/reducers.dart: Added dynamic type annotation to action parameter
- redux/userReducer.dart: Added dynamic type annotation to action parameter
Android Build Configuration Updates:
- Updated compileSdkVersion and targetSdkVersion from 34 to 36 to match plugin requirements
- Moved plugins {} block to first position (Gradle 8.14 requirement)
- Added dev.flutter.flutter-gradle-plugin to plugins block for modern Flutter integration
- Removed deprecated useProguard setting, replaced with shrinkResources
- Disabled Jetifier (android.enableJetifier=false) to improve build performance
- Increased JVM heap allocation to 4096M for large project compilation
- Added Kotlin language version 1.8 override for plugin compatibility
- Added ProGuard rules to exclude optional Google Play Core classes
Build Results:
- ✅ APK builds successfully (146MB debug APK)
- ✅ Zero type inference errors detected by dart analyze
- ✅ Kotlin compilation passes
- ✅ R8 minification configured correctly
- ✅ 301 remaining issues are all INFO-level style suggestions (non-blocking)
This commit is contained in:
parent
956165c524
commit
7812ed951e
19 changed files with 129 additions and 111 deletions
|
|
@ -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,27 +12,12 @@ if (localPropertiesFile.exists()) {
|
|||
}
|
||||
}
|
||||
|
||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
||||
if (flutterRoot == null) {
|
||||
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
}
|
||||
|
||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||
def keystoreProperties = new Properties()
|
||||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
|
||||
// Load Flutter's Gradle plugin
|
||||
if (flutterRoot != null) {
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 34
|
||||
compileSdkVersion 36
|
||||
namespace "org.comunes.fires"
|
||||
|
||||
lintOptions {
|
||||
|
|
@ -37,7 +28,7 @@ android {
|
|||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "org.comunes.fires"
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion 34
|
||||
targetSdkVersion 36
|
||||
versionCode 9
|
||||
versionName "1.9"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
|
@ -57,7 +48,7 @@ android {
|
|||
signingConfig signingConfigs.release
|
||||
|
||||
minifyEnabled true
|
||||
useProguard true
|
||||
shrinkResources true
|
||||
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
|
|
|||
3
android/app/proguard-rules.pro
vendored
3
android/app/proguard-rules.pro
vendored
|
|
@ -14,3 +14,6 @@
|
|||
-keepnames class org.ietf.jgss.** { *; }
|
||||
-dontwarn org.apache.**
|
||||
-dontwarn org.w3c.dom.**
|
||||
|
||||
# Google Play Core libraries - optional features
|
||||
-dontwarn com.google.android.play.core.**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -13,7 +13,16 @@ buildscript {
|
|||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
plugins.withId('kotlin-android') {
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
languageVersion = '1.8'
|
||||
allWarningsAsErrors = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
org.gradle.jvmargs=-Xmx1536M
|
||||
org.gradle.jvmargs=-Xmx4096M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.enableJetifier=false
|
||||
org.jetbrains.kotlin.jvm.target=1.8
|
||||
|
|
|
|||
|
|
@ -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-8.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
include ':app'
|
||||
|
||||
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
def plugins = new Properties()
|
||||
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
|
||||
}
|
||||
|
||||
plugins.each { name, path ->
|
||||
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
|
||||
include ":$name"
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||
40
android/settings.gradle.kts
Normal file
40
android/settings.gradle.kts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
pluginManagement {
|
||||
val flutterSdkPath =
|
||||
run {
|
||||
val properties = java.util.Properties()
|
||||
file("local.properties").inputStream().use { properties.load(it) }
|
||||
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
||||
flutterSdkPath
|
||||
}
|
||||
|
||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.11.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
|
||||
val flutterRoot = rootProject.projectDir.parentFile.toPath()
|
||||
|
||||
val pluginsFile = flutterRoot.resolve(".flutter-plugins").toFile()
|
||||
val plugins = java.util.Properties()
|
||||
if (pluginsFile.exists()) {
|
||||
pluginsFile.inputStream().use { plugins.load(it) }
|
||||
}
|
||||
|
||||
plugins.forEach { name, path ->
|
||||
val pluginDirectory = flutterRoot.resolve(path as String).resolve("android").toFile()
|
||||
include(":$name")
|
||||
project(":$name").projectDir = pluginDirectory
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue