You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/mcp/resources/guides/init_ai.ts
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,10 @@ Take the following actions depending on the language and platform or framework t
61
61
62
62
- Use the firebase_init tool to set up ailogic
63
63
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
+
64
68
### 3\. Implement AI Features
65
69
66
70
#### Gather Building Blocks for Code Generation
@@ -78,6 +82,10 @@ Take the following actions depending on the language and platform or framework t
78
82
- Kotlin Only
79
83
- implementation(platform("com.google.firebase:firebase-bom:34.3.0")) or a higher bom version if it is available
- 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
81
89
- For Flutter apps, always include the following imports. do not forget or modify them
0 commit comments