Skip to content

Commit 7d8dc5f

Browse files
Firebase AI Logic onboarding experience fixes for Flutter and Android. (#9258)
* adding a firebase-tools install step for Flutter project inits specifically * Android onboarding improvements * Firebase CLI typo fix * Another typo fix * consistency change * Update src/mcp/resources/guides/init_ai.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent d00e11f commit 7d8dc5f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/mcp/prompts/core/init.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Follow the steps below taking note of any user instructions provided above.
6363
- Run the \`firebase_list_apps\` tool to list their apps, and find an app that matches their "Workspace platform"
6464
- If there is no app that matches that criteria, use the \`firebase_create_app\` tool to create the app with the appropriate platform
6565
- Do the following only for Flutter apps
66+
- Execute \`firebase --version\` to check if the Firebase CLI is installed
67+
- If it isn't installed, run \`npm install -g firebase-tools\` to install it. If it is installed, skip to the next step.
6668
- Install the Flutterfire CLI
6769
- Use the Flutterfire CLI tool to connect to the project
6870
- Use the Flutterfire CLI to register the appropriate applications based on the user's input

src/mcp/resources/guides/init_ai.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Take the following actions depending on the language and platform or framework t
6161
6262
- Use the firebase_init tool to set up ailogic
6363
64+
- For Android, the Google Services Gradle plugin is required to prevent the app from crashing. You must add it in two files:
65+
- 1. In your project-level \`/build.gradle.kts\` file, add the plugin to the plugins block: id("com.google.gms.google-services") version "4.4.2" apply false
66+
- 2. In your **app-level** \`/app/build.gradle.kts\` file, apply the plugin: id("com.google.gms.google-services")
67+
6468
### 3\. Implement AI Features
6569
6670
#### Gather Building Blocks for Code Generation
@@ -78,6 +82,10 @@ Take the following actions depending on the language and platform or framework t
7882
- Kotlin Only
7983
- implementation(platform("com.google.firebase:firebase-bom:34.3.0")) or a higher bom version if it is available
8084
- implementation("com.google.firebase:firebase-ai")
85+
- CRITICAL: When initializing the Firebase AI model in Kotlin, you must explicitly specify the Google AI backend by calling the googleAI() function. The correct syntax is GenerativeBackend.googleAI().
86+
- Correct Example: val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(...)
87+
- Incorrect: Do not use the invalid constant GenerativeBackend.GOOGLE_AI.
88+
- The Kotlin SDK public API makes extensive use of suspend functions and coroutines. Make sure the code you generate is based on that paradigm and avoid using callbacks unless absolutely necessary in Kotlin
8189
- For Flutter apps, always include the following imports. do not forget or modify them
8290
- import 'package:firebase_core/firebase_core.dart';
8391
- import 'package:firebase_ai/firebase_ai.dart';

0 commit comments

Comments
 (0)