Gemini Nano ML Kit GenAI Migration - Fix Summary
✅ Issue Resolved
Problem: Build failure due to non-existent genai-prompt:1.0.0-beta1 dependency
Could not find com.google.mlkit:genai-prompt:1.0.0-beta1
Root Cause: The Prompt API package does not exist in version 1.0.0-beta1. Only 4 GenAI APIs are available in beta1:
- ✅ genai-summarization
- ✅ genai-image-description
- ✅ genai-proofreading
- ✅ genai-rewriting
- ❌ genai-prompt (NOT AVAILABLE)
🔧 Changes Made
1. Updated app/android/app/build.gradle.kts
Removed: implementation("com.google.mlkit:genai-prompt:1.0.0-beta1")
Result: Only 4 available GenAI APIs are now declared:
implementation("com.google.mlkit:genai-summarization:1.0.0-beta1")
implementation("com.google.mlkit:genai-image-description:1.0.0-beta1")
implementation("com.google.mlkit:genai-proofreading:1.0.0-beta1")
implementation("com.google.mlkit:genai-rewriting:1.0.0-beta1")
2. Updated app/android/app/src/main/kotlin/com/airo/superapp/GeminiNanoPlugin.kt
Removed:
- Import statements for
PromptandPromptOptions prompter: Prompt?propertyprompterStatus: FeatureStatusproperty"prompt"method call handlerrunPrompt()method (21 lines)- Prompt API initialization in
initializeGenAiApis() - Prompt API close in
closeApis()
Result: Plugin now only supports 4 GenAI features:
- Summarization - Summarize articles/conversations
- Image Description - Generate image descriptions
- Proofreading - Polish content (grammar/spelling)
- Rewriting - Reword content in different styles
📋 Available Methods
The plugin now exposes these Flutter methods:
// Check if Gemini Nano is available on device
await channel.invokeMethod('isAvailable')
// Initialize all 4 GenAI APIs
await channel.invokeMethod('initialize')
// Check feature status (UNAVAILABLE, DOWNLOADABLE, DOWNLOADING, AVAILABLE)
await channel.invokeMethod('checkFeatureStatus', {'feature': 'summarization'})
// Download model for a feature
await channel.invokeMethod('downloadFeature', {'feature': 'summarization'})
// Use the APIs
await channel.invokeMethod('summarize', {'text': 'article text'})
await channel.invokeMethod('describeImage', {'imagePath': '/path/to/image'})
await channel.invokeMethod('proofread', {'text': 'content to proofread'})
await channel.invokeMethod('rewrite', {'text': 'content', 'style': 'formal'})
// Close all APIs
await channel.invokeMethod('close')
// Get device info
await channel.invokeMethod('getDeviceInfo')
🚀 Next Steps
- Build the app:
cd app flutter clean flutter pub get flutter run -d "192.168.1.77:33535" - Monitor the build:
- Watch for Gradle compilation
- Check for any remaining dependency issues
- Verify APK is built successfully
- Test on Pixel 9:
- App should install without errors
- Call
initialize()to set up GenAI APIs - Call
checkFeatureStatus('summarization')to check model status - If status is DOWNLOADABLE, call
downloadFeature('summarization') - Monitor logs:
adb logcat -s GeminiNanoPlugin flutter
- Update Flutter Service (if needed):
- Review
packages/airo/lib/src/features/gemini_nano/gemini_nano_service.dart - Update method calls to match new plugin API
- Remove any references to the Prompt API
- Review
📊 Feature Comparison
| Feature | Status | Use Case |
|---|---|---|
| Summarization | ✅ Available | Summarize diet plans, bills, forms |
| Image Description | ✅ Available | Describe food images, bill photos |
| Proofreading | ✅ Available | Polish form text, notifications |
| Rewriting | ✅ Available | Reword notifications in different styles |
| Prompt (Custom) | ❌ Not in beta1 | Will be available in future release |
🔗 References
✨ Status
✅ Build should now succeed - All non-existent dependencies removed ✅ Plugin is clean - No references to unavailable APIs ✅ Ready for testing - Can now deploy to Pixel 9 device