Getting Started
Run Gemini Nano on Android, on the device, with the Vercel AI SDK. Android provides the model through AICore, so there’s no model to bundle and no API key. When you need a larger model or support for every device, the same provider runs cloud Gemini. It’s built on Google’s Agent Development Kit.
Installation
Section titled “Installation”npm install @react-native-ai/adk aiyarn add @react-native-ai/adk aipnpm add @react-native-ai/adk aibun add @react-native-ai/adk aiThe AI SDK needs its polyfills.
Requirements
Section titled “Requirements”- Android with
minSdkVersion26 or higher - React Native 0.76 or newer, with the New Architecture
- For Gemini Nano, a physical device with AICore support, running Android 14 or newer. See the ML Kit GenAI documentation for the supported devices. Cloud Gemini works on any device.
Native Setup
Section titled “Native Setup”Raise minSdkVersion to 26, and exclude two files that Google’s libraries both ship, so the build doesn’t fail on duplicates.
With expo-build-properties:
{ "expo": { "plugins": [ [ "expo-build-properties", { "android": { "minSdkVersion": 26, "packagingOptions": { "exclude": ["META-INF/INDEX.LIST", "META-INF/DEPENDENCIES"] } } } ] ] }}Then regenerate the native project:
npx expo prebuild --cleanBare React Native
Section titled “Bare React Native”Add this to android/app/build.gradle, and set minSdkVersion to 26:
android { packagingOptions { excludes += ["META-INF/INDEX.LIST", "META-INF/DEPENDENCIES"] }}Basic Usage
Section titled “Basic Usage”Pass adk() to the AI SDK. Check that Gemini Nano can run on the device first:
import { adk } from '@react-native-ai/adk'import { generateText } from 'ai'
if (await adk.isAvailable('genai-nano')) { const { text } = await generateText({ model: adk(), prompt: 'Summarize on-device AI in one sentence.', })}Models & Availability covers the availability checks and cloud Gemini.
Next Steps
Section titled “Next Steps”- Generating: streaming, tool calling, image input and JSON output
- Models & Availability: checking for Gemini Nano, cloud Gemini and provider options