The ADK provider brings on-device Gemini Nano to Android React Native apps through Google's Agent Development Kit (ADK) and the Vercel AI SDK. Gemini Nano runs locally via ML Kit GenAI - provisioned by the Android system through AICore, with no API key and no model files to bundle. You also get cloud Gemini as an option when you need a larger model or broader device support.
Install the ADK provider:
While you can use the ADK provider standalone, we recommend using it with the Vercel AI SDK for a much better developer experience. The AI SDK provides unified APIs, streaming support, and advanced features. To use with the AI SDK, you'll need v5+ and required polyfills:
minSdkVersion 26 or greater - Required by ML Kit GenAI / Gemini NanoGemini Nano requires a physical Android device with AICore support and support for the Gemini Nano models. Please consult the ML Kit GenAI documentation.
Cloud Gemini works on all devices supported by ADK & MLKit when an API key is configured.
Consuming apps must set minSdkVersion to at least 26. ADK pulls in Google GenAI libraries that duplicate META-INF/INDEX.LIST; exclude it in your app packaging via expo-build-properties:
After changing CNG config, run:
Add the following to android/app/build.gradle:
Ensure your app's minSdkVersion is at least 26.
| Model Type | modelType | Default Name | Use Case |
|---|---|---|---|
| On-device Gemini Nano | genai-nano | gemini-nano | Private, offline-capable inference - system-provisioned via AICore |
| Cloud Gemini | gemini | gemini-2.5-flash | Cloud inference via Google AI API |
Import the default ADK provider and call adk() to construct a language model, then pass it to the AI SDK. The default export targets on-device Gemini Nano (gemini-nano):
See Cloud Gemini when you need cloud inference instead.
Gemini Nano runs locally via ML Kit GenAI and is provisioned by the Android system (AICore). The default adk() export already targets Nano — check availability and prepare before generating:
To customize the system instruction or register tool executors, create a provider with createAdkProvider:
Nano has two separate checks:
| API | Label | Question |
|---|---|---|
adk.isNanoSupported() | Device capability | Can this device ever run Nano? |
adk.isAvailable('genai-nano') | Runtime readiness | Can I call prepareNano() / generate now? |
If isNanoSupported() is false, isAvailable('genai-nano') is also false.
Both checks are cheap native calls (no model download), safe to cache at app startup and re-check after resume.
Both checks use ML Kit Generation.getClient().checkStatus():
| Status | isNanoSupported() | isAvailable('genai-nano') | Suggested UX |
|---|---|---|---|
0 | false | false | Hide or disable - not supported |
1 | true | true | Ready - call prepareNano() |
3 | true | true | Ready to download - call prepareNano() |
| Other non-zero | true | false | Show disabled - not ready yet |
If needed, consult the ML Kit GenAI Prompt API for details.
model.prepare(), generateText(), and streamText() auto-call prepareNano() for genai-nano models, but only gate on isNanoSupported(). For UI gating, always use isAvailable('genai-nano') and handle prepare/generation errors in your chat flow.
When you need cloud inference - for example on emulators or devices without AICore - create a provider with modelType: 'gemini' and an API key:
To customize the system instruction or cloud model name:
Do not embed API keys in production client apps. Prefer a backend proxy or secure runtime configuration.
Cloud models do not require a separate download or prepare step.
Use createAdkProvider when you need to change the model type, agent name, system instruction, API key, or registered tool executors. It returns the same callable interface as the default adk export - call it to construct a language model:
| Option | Type | Description |
|---|---|---|
name | string | ADK agent name (default: react_native_adk_agent) |
description | string | Agent description shown to ADK |
instruction | string | System instruction for the agent |
modelType | 'genai-nano' | 'gemini' | On-device or cloud backend (default: genai-nano) |
modelName | string | Model identifier (default: gemini-nano; use gemini-2.5-flash for cloud) |
apiKey | string | Google AI API key - required for cloud gemini only |
availableTools | Record<string, Tool> | Tools whose execute handlers ADK can call from JavaScript |
See Generating for text generation, streaming, tool calling and multimodal input.