基础设施 4.0 · 优秀 2026-07-21 · 文章

Build intelligent Android apps: On-device inference

Google 的 Android 端侧推理文章把 Gemini NanoML Kit GenAI APIMediaPipe LLM Inference API 和 NNAPI 等路径放到同一张开发图里,并强调能力探测模型下载状态结构化输出端云回退和响应时延它适合作为移动 AI 从发布会功能走向工程指标的参考

打开原文回到归档

Build intelligent Android apps: On-device inference

  • ID: a5e8d609
  • 原文链接: https://android-developers.googleblog.com/2026/07/android-on-device-inference.html
  • 作者/来源: Google Android Developers Blog
  • 日期: 2026-07-21
  • 标签: mobile-ai, android, on-device-inference, gemini-nano, llm-infra
  • 质量评分: 4/5
  • 抓取时间: 2026-07-24T23:34:25+08:00
  • 本地证据: OpenClaw定时任务/ClawFeed24小时高价值一览/2026-07-24-ClawFeed24小时高价值一览.md

中文解读

Google 的 Android 端侧推理文章把 Gemini Nano、ML Kit GenAI API、MediaPipe LLM Inference API 和 NNAPI 等路径放到同一张开发图里,并强调能力探测、模型下载状态、结构化输出、端云回退和响应时延。它适合作为移动 AI 从发布会功能走向工程指标的参考。

为什么值得关注

移动 AI 真正落地要看端侧模型生命周期、schema 输出、时延和端云回退,而不只是模型参数。

原文抓取 / Source excerpt

Build intelligent Android apps: On

原文链接: https://android-developers.googleblog.com/2026/07/android-on-device-inference.html

21 July 2026

Build intelligent Android apps: On-device inference

  • * *

Share this post LinkedInTwitterFacebookEmail Copy link

Link copied to clipboard

_Posted by Caren Chang, Developer Relations Engineer, Android Developer Relations_

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIU-6haqWEXnugbhG5is8t1TU0tN3EkfSc7GwvHMRsMSU14k-P7q4il_nJlGk-qNP_PG3aKs1LDWNgWKqhFsG6Q16v2zeoHMvqY_PesC5ddxHRjTGgtiQ33uvOrUIPkSdUgFfBIYSkqBhcuZJTY8jbW0mOjKs8XF8DLxfyD7CjJ1Sd4FM7AUrufTnSEVw/s8582/0625%20Building%20JetPacker%20with%20Intelligent%20On-Device%20features_Blog%20v02.png

Welcome back to the blog post series "Build intelligent Android apps" where we take a basic Android app and transform it into a personalized, intelligent, and agentic experience. In our previous post we introduced Jetpacker, the demo app we'll use throughout this series.

In this blog post, we will share how you can use Gemini Nano through ML Kit’s Prompt API to build intelligent on-device features.

Building intelligent on-device features refers to the ability to process prompts and data directly on a device without sending data to a server. This offers a few advantages:

  • User data can be processed locally on the device, preserving user privacy
  • Functionality of the model is reliable even with spotty or no internet connection
  • No additional cloud inference cost, since everything runs on the user’s hardware

With the benefits of on-device in mind, we identified three features to add in Jetpacker that can improve the user experience: summarizing trip itineraries, managing expenses, and capturing voice notes.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3FDrGSpGJqSapXXQ7052s1NR8rzvmmW-xbyOaAcg8bdTA6ZH7p6ZWE664FjlaoDLfREd-RlQil7gV-VjnCoq76o06haLoSxBzlIDAvM-dKvm_TCgPvqHU3ZlzBTXZ9XtAyMk26QWB8PvU5aUmzO0RBuMxqxJdC1wk7xl_1PXd1KHvuMCeHeAP9zhgSjg/s1848/Screenshot%202026-07-02%20at%2012.57.08%E2%80%AFPM.png

_On-device features in Jetpacker: Summarizing trip itineraries, managing expenses, and voice notes_

High quality tailored summarization of short texts

The itinerary screen gives users a quick overview of all activities for a given trip. Since this screen contains a lot of information, it can quickly become overwhelming. To help users prepare without feeling overwhelmed, we can add a ‘Get ready for your trip’ section at the top.

_https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtWrJplvxl7ymB4kMN_Tg4tYYkL7G1Ory0hSptzqsbw_xCu4I9l_4SQPQ9CUXs_Jc7qtT1KcpltBds0aYgIvXiK_-qp6fnoX3QmYnGyqGgr2d5f2uzQkyMK-_Iebwp9Ap0aJA4c8Pz4Zy01O5AM6kk_qZ4Blx_bY-_2xIxSA8DMva2LWBbCN_Hb_c37KE/s2499/Screenshot_20260702_111934.png_

_The romantic Paris trip is summarized as a classic Parisian adventure blending art, sights, and delicious food. A tip and some useful phrases are also added._

By inputting a trip itinerary and asking an LLM to summarize it, we can generate a quick summary of the trip along with packing tips and useful local phrases. This is a great use case for an on-device model for several reasons:

  • Performance and quality: Both the input and output text are relatively short. With that, we can expect the performance and quality of an on-device solution to be on par with more powerful cloud models.
  • Scalability: Shifting inference on-device allows us to scale this feature from a few users to millions without worrying about managing increasing cloud inference costs.
  • Low latency and reliability: On-device inference guarantees low latency, providing a reliable experience even when users are offline.

To build with on-device, we use Gemini Nano, Google’s most efficient model optimized for mobile devices. Gemini Nano was first introduced a few years ago, and is now running on over 140 million devices. The latest version of the model, Gemini Nano 4, is built on the architecture foundation of the recently released Gemma 4 model, and is further optimized for maximum battery and performance efficiency.

Using ML Kit’s Prompt API, we can take advantage of Gemini Nano 4’s new model capabilities to prototype our on-device features. We’ll create a prompt that includes the itinerary of a trip and ask the model to generate a summary along with any preparation tips.

// implementation("com.google.mlkit:genai-prompt:1.0.0-beta3")

// Define the configuration for Gemini Nano 4 E2B preview model
val previewFastConfig = generationConfig {
    modelConfig = modelConfig {
        releaseStage = ModelReleaseStage.PREVIEW
        preference = ModelPreference.FAST
    }
}

val geminiNano2BPreviewModel = Generation.getClient(previewFastConfig)

val tripItinerary = ...

val getReadyForYourTripSummary = geminiNano2BPreviewModel
 .generateContent("Given this trip itinerary: $tripItinerary,
     generate the following: overall vibe, tips on how to prepare for this
     trip, and common short phrases to learn for the trip.")

Finding the optimal prompt usually requires some iteration, and the AICore app is perfect for this step in the process. After opting into the developer preview option for AICore, we can download preview models such as Gemini Nano 4 to test prompts and see the model’s expected outputs. With a few iterations on the prompt, we were able to improve the speed of the response from 13 seconds to under 2 seconds! Check out the final code implementation and prompt here.

[](https://blogger.googleusercont

Obsidian evidence excerpt

# ClawFeed 24小时高价值一览 · 2026-07-24
- status: completed
- Obsidian: /Users/gracker/Library/Mobile Documents/iCloud~md~obsidian/Documents/Obsidian/OpenClaw定时任务/ClawFeed24小时高价值一览/2026-07-24-ClawFeed24小时高价值一览.md
- Evidence: /Users/gracker/.hermes/evidence/clawfeed/2026-07-24

任务信息:
- 任务名称:ClawFeed 24小时高价值一览(For You+Bookmarks)
- 处理数量:候选 80 篇,认真阅读 6 篇,入选 4 篇
- 数据源:OpenCLI Hacker News top、StackOverflow hot、arXiv search、DuckDuckGo search;正文读取使用 OpenCLI web read
- 落盘路径:/Users/gracker/Library/Mobile Documents/iCloud~md~obsidian/Documents/Obsidian/OpenClaw定时任务/ClawFeed24小时高价值一览/2026-07-24-ClawFeed24小时高价值一览.md
- 验证状态:已落盘且非空

## 今日精选
1. Open source AI 的政策争论开始从“安全口号”落到“美国创业公司成本结构”:如果禁用中国 open-weight 模型,受益者很可能是少数闭源 frontier lab,受损的是用低成本模型做产品的团队。
2. ATProto 这篇值得看,不是社交协议八卦,而是一个应用开发者从 local-first、私有数据、离线同步角度拆协议设计的实际代价。
3. Agentic AI 评估论文给了一个很实用的抓手:只报 benchmark 分数不够,应该公开 Thought-Action-Result 轨迹和 LLM 交互数据,否