androidengineers.Book a session

PocketStories study guide

PocketStories study guide

articleSelf-paced

The app and the learning contract

PocketStories turns a deliberate camera snapshot into inspiration for a fictional adventure. The intended journey is choose a genre → capture or select an image → write a draft → accept or discard it → continue from accepted scenes. You will inspect a completed preview implementation, run its tests, and implement a context-policy improvement. This is a run–understand–extend course, not a blank-project tutorial.

Preview: the source builds and its 17 unit tests and three UI tests passed. Successful photo-to-story generation is not yet verified. The tested emulator reaches a GPU buffer limit. These lessons are complete learning material for the preview; they do not certify a production-ready AI application. Model output, native cancellation and airplane-mode generation require your own evidence.

Reproduce the baseline

Prerequisites: Kotlin, Compose state, coroutines, basic HTTP, Android Studio, JDK 17, SDK 36, and an API 31+ ARM64 test device. Allow several focused sessions; timings have not been measured. The model download needs internet, about 2.59 GB of data and at least 3.2 GB free storage. No Firebase project or Gemini API key is needed.

git clone https://github.com/AndroidEngineers/android-ai-cookbook.git
cd android-ai-cookbook
git switch --detach c03e81d983af7fb30c0af0867770927efdb6f23a
git switch -c learning/pocketstories
cd gemma
./gradlew :app:assembleDebug :app:testDebugUnitTest :app:lintDebug

Open gemma/ in Android Studio, not the repository root. Configure your SDK through Studio; local.properties is machine-specific and must not be committed. Windows users can substitute gradlew.bat. Install the debug build on the selected device; do not replace it with an APK from another checkpoint.

Two evidence tracks

The software track covers Compose, CameraX, storage, model acquisition and tests; an emulator is enough. The inference track requires a runtime/backend/device combination that can actually execute this model. Record that combination, even when it fails. Mark blocked inference as blocked, not passed. Handwritten sample prose is useful for UI exploration but is never a substitute for generated output.

Practice and checkpoint

Create a learning log with commit, SDK, Android version, device/ABI, backend, test results and outstanding failures. Open the sample story and identify its handwritten label. Run the command above and retain the result. Explain why compilation proves API compatibility but cannot prove successful GPU execution. Expected answer: native model loading, allocations and operators happen on the target device, after compilation.

Roadmap · Hands-on codelab · Pinned source

YOUR LEARNING JOURNEY

0 of 13 available lessons completed

Progress saved in this browser. No account needed.
PocketStories study guide | Gemma on Android with PocketStories — Preview | Android Engineers