Skip to content

Conversation

xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Sep 16, 2025

This PR upgrades the Android Gradle Plugin and related dependencies in the sample application.

Key changes:

  • Upgraded Gradle wrapper to version 8.10.2.
  • Updated Android Gradle Plugin to 8.7.0.
  • Updated Kotlin Gradle Plugin to 2.1.0.
  • Updated com.google.gms.google-services to 4.3.10.
  • Updated desugar_jdk_libs to 2.0.4.
  • Updated NDK version to 27.0.12077973.
  • Refactored app/build.gradle to align with modern Flutter Android project structure, including:
    • Using flutter.compileSdkVersion, flutter.minSdkVersion, flutter.targetSdkVersion, flutter.versionCode, and flutter.versionName for configuration.
    • Setting sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11.
    • Setting kotlinOptions.jvmTarget to JavaVersion.VERSION_11.toString().
  • Removed settings_aar.gradle as it is no longer needed.
  • Updated build.gradle to use rootProject.layout.buildDirectory instead of rootProject.buildDir.
  • Ensured subprojects align their compileSdkVersion with flutter.compileSdkVersion.
  • Set the namespace for all subprojects if not already set.

Summary by CodeRabbit

  • New Features

    • Enabled Google services integration across Android, iOS, macOS, and Web via FlutterFire.
    • Updated Firebase/OAuth configuration to a new project, improving sign-in and service connectivity.
    • Adopted Flutter-driven app versioning and SDK alignment for more consistent builds.
  • Chores

    • Upgraded Gradle and Android/Kotlin tooling for better compatibility and stability.
    • Modernized build setup (namespace, Java/Kotlin 11, desugaring) and removed legacy settings.
    • Added refreshed platform configuration files for Firebase across mobile and desktop targets.

This commit upgrades the Android Gradle Plugin and related dependencies in the sample application.

Key changes:
- Upgraded Gradle wrapper to version 8.10.2.
- Updated Android Gradle Plugin to 8.7.0.
- Updated Kotlin Gradle Plugin to 2.1.0.
- Updated `com.google.gms.google-services` to 4.3.10.
- Updated `desugar_jdk_libs` to 2.0.4.
- Updated NDK version to 27.0.12077973.
- Refactored `app/build.gradle` to align with modern Flutter Android project structure, including:
    - Using `flutter.compileSdkVersion`, `flutter.minSdkVersion`, `flutter.targetSdkVersion`, `flutter.versionCode`, and `flutter.versionName` for configuration.
    - Setting `sourceCompatibility` and `targetCompatibility` to `JavaVersion.VERSION_11`.
    - Setting `kotlinOptions.jvmTarget` to `JavaVersion.VERSION_11.toString()`.
- Removed `settings_aar.gradle` as it is no longer needed.
- Updated `build.gradle` to use `rootProject.layout.buildDirectory` instead of `rootProject.buildDir`.
- Ensured subprojects align their `compileSdkVersion` with `flutter.compileSdkVersion`.
- Set the namespace for all subprojects if not already set.
This commit updates the Firebase configurations for the sample application across various platforms and files.

Key changes include:

- **`firebase.json`**: New file added, defining Firebase project IDs and app IDs for Android, iOS, macOS, and Dart.
- **`sample_app/macos/Runner/GoogleService-Info.plist`**: Updated `ANDROID_CLIENT_ID`.
- **`sample_app/lib/firebase_options.dart`**:
    - Updated `apiKey`, `appId`, and `measurementId` for `web` FirebaseOptions.
    - Updated `appId` for `android` FirebaseOptions.
    - Updated `androidClientId` for both `ios` and `macos` FirebaseOptions.
- **`sample_app/android/app/google-services.json`**:
    - Updated `client_id` and `ios_info.bundle_id` for multiple client entries.
    - Added new client entries with updated `mobilesdk_app_id` and `package_name`.
- **`sample_app/ios/Runner/GoogleService-Info.plist`**: Updated `ANDROID_CLIENT_ID`.
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Walkthrough

Introduces FlutterFire/Google Services to the sample app, updates Android Gradle plugins and wrapper, aligns SDK/namespace and Kotlin/Java targets, switches to Flutter-provided Android config, refreshes desugaring libs, and updates Firebase credentials/config across Android, iOS, macOS, and Dart. Removes legacy Gradle settings and afterEvaluate logic.

Changes

Cohort / File(s) Summary of changes
Android app Gradle refactor & Flutter-aligned config
sample_app/android/app/build.gradle
Adds com.google.gms.google-services plugin; sets namespace; uses flutter.* versions for compile/min/target/version; updates ndkVersion; adds compileOptions (Java 11) and kotlinOptions (JVM 11); enables core library desugaring; removes legacy afterEvaluate, lintOptions, sourceSets; updates desugar libs to 2.0.4.
Root Android build logic & Layout API
sample_app/android/build.gradle
Migrates to layout.buildDirectory; sets android.namespace from project.group if missing; sets android.compileSdkVersion from flutter.compileSdkVersion; updates clean task; removes manifest-based namespace inference.
Gradle plugins and versions
sample_app/android/settings.gradle
Bumps Android Gradle Plugin to 8.7.0; Kotlin plugin to 2.1.0; adds com.google.gms.google-services (apply false).
Gradle wrapper update
sample_app/android/gradle/wrapper/gradle-wrapper.properties
Upgrades wrapper from Gradle 8.9 to 8.10.2.
AAR settings cleanup
sample_app/android/settings_aar.gradle
Removes include ':app', leaving the file empty.
Firebase runtime options (Dart)
sample_app/lib/firebase_options.dart
Updates Web/Android credential strings; updates iOS/macOS androidClientId. No API shape changes.
Firebase JSON config (Android)
sample_app/android/app/google-services.json
Replaces/extends OAuth client IDs, API keys, and app blocks; updates package/bundle identifiers; adds entries for new app identifiers.
Firebase project mapping
sample_app/firebase.json
Adds FlutterFire CLI config for Android/iOS/macOS/Web outputs and IDs.
iOS/macOS GoogleService plists
sample_app/ios/Runner/GoogleService-Info.plist, sample_app/macos/Runner/GoogleService-Info.plist
Updates ANDROID_CLIENT_ID values; other keys unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant Gradle as Gradle Build
  participant GMS as Google Services Plugin
  participant App as Android App
  participant Firebase as Firebase SDK

  Dev->>Gradle: Run assemble/debug
  Gradle->>GMS: Apply google-services plugin
  GMS->>Gradle: Parse google-services.json and generate resources
  Gradle->>App: Merge generated resources and configs
  App->>Firebase: Initialize with firebase_options.dart at runtime
  Firebase-->>App: Services available (Auth/Analytics/etc.)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–70 minutes

Suggested reviewers

  • renefloor

Poem

A hop and a skip through Gradle fields,
I stitch in clouds where Firebase yields.
Plugins bloom, desugars shine,
Kotlin hums at JVM eleven fine.
IDs refreshed, the carrots align—
Build, run, nibble: everything’s divine. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary intent of the changeset—upgrading the Android Gradle plugin and related dependencies in the samples. It matches the PR objectives and the key file-level changes (Gradle wrapper, AGP, Kotlin plugin, google-services, desugar, NDK, and build.gradle/settings updates). The phrasing is specific and informative rather than vague or noisy, so a teammate scanning history will understand the primary change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/android-build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xsahil03x xsahil03x requested a review from renefloor September 16, 2025 15:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (12)
sample_app/android/gradle/wrapper/gradle-wrapper.properties (1)

6-6: Add wrapper checksum for supply‑chain hardening.
Include distributionSha256Sum to verify the downloaded Gradle distribution.

Apply this diff:

 distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
+distributionSha256Sum=<paste SHA-256 for gradle-8.10.2-all.zip>

Reference: Gradle docs recommend checksum verification for the wrapper. (docs.gradle.org)

sample_app/lib/firebase_options.dart (1)

46-56: Heads‑up: Gitleaks false positive on Firebase Web API key.
Firebase apiKey/measurementId here are expected in client apps and aren’t secrets; keep rules locked down server‑side. If these aren’t test creds, confirm intent.

Static analysis flagged these lines as GCP keys; acknowledge and proceed if this is a sample project configuration.

sample_app/android/settings.gradle (1)

21-26: Versioning sanity check + recommended bumps.

Apply this diff:

-    id "com.google.gms.google-services" version "4.3.10" apply false
+    id "com.google.gms.google-services" version "4.4.3" apply false
sample_app/android/build.gradle (4)

8-8: Prefer property setters for Layout API.
Use .set(...) to avoid Groovy coercion pitfalls.

-rootProject.layout.buildDirectory = "../build"
+rootProject.layout.buildDirectory.set(file("../build"))

10-10: Ditto for subproject build directories.

-    project.layout.buildDirectory = rootProject.layout.buildDirectory.dir(project.name)
+    project.layout.buildDirectory.set(rootProject.layout.buildDirectory.dir(project.name))

12-21: Avoid afterEvaluate; set Android DSL via plugin hooks and use compileSdk (not compileSdkVersion).

  • afterEvaluate can cause ordering issues.
  • compileSdkVersion is deprecated in favor of compileSdk. (developer.android.com)
-    afterEvaluate { project ->
-        if (project.hasProperty("android")) {
-            // Set the namespace for all subprojects if not set
-            if (android.namespace == null) {
-                android.namespace = project.group
-            }
-
-            // Align the compileSdkVersion with Flutter's compileSdkVersion
-            android.compileSdkVersion = flutter.compileSdkVersion
-        }
-    }
+    plugins.withId("com.android.application") {
+        android {
+            // Only set if missing; prefer explicit namespace per module.
+            if (namespace == null && project.group) {
+                namespace = "${project.group}.${project.name}"
+            }
+            compileSdk = flutter.compileSdkVersion
+        }
+    }
+    plugins.withId("com.android.library") {
+        android {
+            if (namespace == null && project.group) {
+                namespace = "${project.group}.${project.name}"
+            }
+            compileSdk = flutter.compileSdkVersion
+        }
+    }

26-26: evaluationDependsOn(':app') may slow configuration.
Unless you rely on :app’s evaluated values, consider removing it.

sample_app/android/app/build.gradle (3)

13-14: Use compileSdk instead of compileSdkVersion.
AGP DSL favors compileSdk. (developer.android.com)

-    compileSdkVersion flutter.compileSdkVersion
+    compileSdk = flutter.compileSdkVersion

51-55: Migrate APK renaming to androidComponents API.
applicationVariants is legacy; prefer onVariants/onVariantProperties to avoid deprecation risk in AGP 9+. (developer.android.com)

Example (KTS shown; adapt to Groovy if desired):

androidComponents {
  onVariants { v ->
    v.outputs.forEach { out ->
      out.outputFileName.set("flutter-sample-app-${v.name}.apk")
    }
  }
}

63-64: Update desugaring libs.
2.1.5 is current; consider upgrading. (mvnrepository.com)

-    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
+    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
sample_app/android/app/google-services.json (2)

244-245: API key hygiene: ensure restriction + rotation policy.

google-services.json is public-safe, but confirm this key is restricted to the Firebase project and Android package+SHA-1 signers. Rotate if any unintended exposure is suspected.

Also applies to: 544-545, 616-617, 652-653, 688-689


229-264: Trim unused google-services.json client for compose "pntest.debug".

Gradle defaultConfig (sample_app/android/app/build.gradle) declares applicationId "io.getstream.chat.android.flutter.sample", while google-services.json contains a client for "io.getstream.chat.android.compose.sample.pntest.debug" — remove the client block in sample_app/android/app/google-services.json (lines 229–264) unless that appId is intentionally built/used.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 62e2956 and b1dd3e3.

📒 Files selected for processing (10)
  • sample_app/android/app/build.gradle (2 hunks)
  • sample_app/android/app/google-services.json (14 hunks)
  • sample_app/android/build.gradle (1 hunks)
  • sample_app/android/gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • sample_app/android/settings.gradle (1 hunks)
  • sample_app/android/settings_aar.gradle (0 hunks)
  • sample_app/firebase.json (1 hunks)
  • sample_app/ios/Runner/GoogleService-Info.plist (1 hunks)
  • sample_app/lib/firebase_options.dart (3 hunks)
  • sample_app/macos/Runner/GoogleService-Info.plist (1 hunks)
💤 Files with no reviewable changes (1)
  • sample_app/android/settings_aar.gradle
🧰 Additional context used
🪛 Gitleaks (8.27.2)
sample_app/lib/firebase_options.dart

[high] 47-47: Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.

(gcp-api-key)


[high] 58-58: Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches.

(gcp-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: stream_chat_flutter
  • GitHub Check: stream_chat_flutter_core
  • GitHub Check: stream_chat
  • GitHub Check: stream_chat_localizations
  • GitHub Check: stream_chat_persistence
🔇 Additional comments (13)
sample_app/android/gradle/wrapper/gradle-wrapper.properties (1)

6-6: Gradle 8.10.2 is compatible with AGP 8.7 — good upgrade.
AGP 8.7 requires Gradle ≥ 8.9; 8.10.2 fits. Also aligns with NDK 27 default. (developer.android.com)

sample_app/lib/firebase_options.dart (2)

57-65: Android appId update looks consistent with firebase.json.
No action; just ensure google‑services.json under android/app matches this appId.


66-76: iOS/macOS OAuth client IDs updated — verify sign‑in flows.
Confirm Google Sign‑In still works on iOS/macOS after client swap.

sample_app/android/build.gradle (1)

29-31: LGTM on Layout API for clean.
Uses rootProject.layout.buildDirectory correctly.

sample_app/android/app/build.gradle (3)

3-5: Google Services plugin: align with 4.4.3.
You declare the version in settings.gradle; after bumping there, this stays as‑is. Just noting the required root change. (developers.google.com)


14-15: NDK version matches AGP guidance — good.
AGP 8.7 defaults to NDK 27.0.12077973. (developer.android.com)


26-32: DefaultConfig via Flutter ext looks good.
Min SDK gate to 23 is fine with desugaring.

sample_app/ios/Runner/GoogleService-Info.plist (1)

10-10: Confirm OAuth alignment.
ANDROID_CLIENT_ID changed; ensure it matches firebase_options.dart and any Google Sign‑In configuration in code.

sample_app/macos/Runner/GoogleService-Info.plist (1)

10-10: Confirm macOS OAuth alignment.
Same as iOS — verify sign‑in still succeeds with the new client.

sample_app/firebase.json (1)

1-40: FlutterFire config looks coherent across platforms.
IDs here match the generated Dart/options; outputs point to the right files.

sample_app/android/app/google-services.json (3)

591-596: New Android client for io.getstream.expotiktokapp added—verify it belongs here.

If this app isn’t part of this sample’s variants, remove this client. If it is, ensure app/build.gradle’s applicationId matches exactly so the Google Services plugin resolves the right stanza.

Also applies to: 601-636


307-311: Consistent OAuth client swap (…36up).

The repeated client_id replacement looks systematic. Double‑check the matching OAuth/Web credentials exist in the same Firebase project to avoid Sign‑In/Invites mismatches.

Also applies to: 343-347, 379-383, 415-419, 459-463, 511-515, 555-559, 591-596


51-55: Confirm cross‑project iOS bundle_id in google-services.json

Found a single ios bundle_id in sample_app/android/app/google-services.json: io.getstream.expotiktokapp. Confirm this is intentional (shared Firebase project). If not intentional, revert the appinvite.other_platform_oauth_client ios_info.bundle_id entries to the expected bundle_id(s) to avoid credential drift.

@xsahil03x
Copy link
Member Author

@xsahil03x xsahil03x merged commit e8f5dfa into master Sep 17, 2025
15 of 19 checks passed
@xsahil03x xsahil03x deleted the fix/android-build branch September 17, 2025 12:50
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.

2 participants