Skip to content

Fix Android Gradle and on_device_tts build warnings - #1697

Merged
kevmo314 merged 2 commits into
mainfrom
fix-warnings
Oct 24, 2026
Merged

kevmo314 merged 2 commits into
mainfrom
fix-warnings

Conversation

@kevmo314

Copy link
Copy Markdown
Contributor

Fixes the Android build warnings that come from our own build files and the on_device_tts plugin.

Merge order: merge this after the AudioService foreground-service PR. AudioService.kt imports androidx.multidex.BuildConfig, which only resolves because of the multidex dependency removed here. Without that PR, :app:compileDebugKotlin fails with Unresolved reference 'BuildConfig'. Note for that PR: the app's own com.rtirl.chat.BuildConfig isn't generated either, because AGP turns buildFeatures.buildConfig off by default. So the fix there needs a string literal or buildFeatures { buildConfig = true }.

android/gradle.properties

  • Removed android.enableJetifier=true. :app:dependencies shows no com.android.support or android.arch artifacts in the debug or release runtime classpaths.
  • Added org.gradle.caching=true.
  • Kept android.builtInKotlin=false and android.newDsl=false because the build fails without them:
    • Without newDsl=false, the Flutter Gradle plugin (3.47.7) fails to apply because it casts to the legacy AbstractAppExtension.
    • Without builtInKotlin=false, flutter_web_auth_2 (and the firebase_* / cloud_functions plugins) still apply kotlin-android, and AGP 9 refuses that.
    • While builtInKotlin=false is set, the Flutter Gradle plugin applies kotlin-android to :app itself. So the "Deprecated 'org.jetbrains.kotlin.android' plugin usage" warning for :app and the kotlin-android entry in settings.gradle both have to stay until those upstream plugins migrate.

android/app/build.gradle

  • Removed the multidex dependency and multiDexEnabled true. The Flutter default minSdk is 24.
  • Removed the duplicate namespace.
  • Converted the propName value assignments to propName = value (Gradle 10 removes the old form). compileSdkVersion, minSdkVersion and targetSdkVersion become compileSdk, minSdk and targetSdk.

packages/on_device_tts

  • build.gradle.kts: android {} becomes configure<com.android.build.api.dsl.LibraryExtension> {}, and srcDirs(...) becomes directories.add(...). These were the last 3 script-compile warnings.
  • SystemTtsPlugin.kt: removed 2 unnecessary !!. The plugin already uses AudioFocusRequest on API 26+. Because minSdk is 24, the pre-26 fallback stays, with a scoped @Suppress("DEPRECATION").

Warning counts, from ./gradlew assembleDebug --warning-mode all --rerun-tasks before and after. AudioService's import was patched locally for the "after" run and is not part of this PR.

before after
AGP WARNING: lines 13 11 (multidex and jetifier gone)
Gradle deprecation lines 52 46
"propName value" deprecations 13 9 (all from pub-cache plugins)
Kotlin compiler problems 66 62
on_device_tts build.gradle.kts script warnings 3 0

Nothing that remains comes from our own files. It's all from the Flutter Gradle plugin and third-party plugins in the pub cache:

  • legacy variant API calls
  • kotlin-android deprecations
  • Project.getProperties
  • project-object dependency notation
  • deprecations in plugin Kotlin code
  • the warning in AudioService.kt, which is another PR's file

Checked (with the AudioService import patched locally):

  • flutter build apk --debug
  • ./gradlew assembleDebug
  • ./gradlew :on_device_tts:testDebugUnitTest
  • flutter analyze (no issues)
  • flutter test (467 passed)
  • flutter test in packages/on_device_tts (95 passed)

@kevmo314
kevmo314 temporarily deployed to android-internal October 24, 2026 05:41 — with GitHub Actions Inactive
@kevmo314
kevmo314 merged commit c3370c1 into main Oct 24, 2026
11 checks passed
@kevmo314
kevmo314 deleted the fix-warnings branch October 24, 2026 05:54

This branch was successfully deployed

1 active and 1 inactive deployments
ios-testflight — 9af28c31 Deployed Oct 24, 2026 by kevmo314 via ios / ipa #1753
android-internal — 9af28c31 Deployed Oct 24, 2026 by kevmo314 via android / apkaab #1753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant