# Google AI Studio & Gemini Web Apps Closed Testing Playbook: Key Proxy, Capacitor AAB & UGC Policy

> Transform exported Google AI Studio React/Vite prototypes into secure, Play-compliant Android App Bundles without leaking Gemini API keys or failing Generative AI UGC policies.

- **Canonical URL**: https://gootester.com/frameworks/google-ai-studio
- **Config File**: vite.config.ts, capacitor.config.ts & android/app/build.gradle
- **Build Command**: `npm run build && npx cap sync android && cd android && ./gradlew bundleRelease --no-daemon`

```typescript
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// IMPORTANT: Never inject GEMINI_API_KEY into client define{} for Android builds!
export default defineConfig({
  plugins: [react()],
  base: "./",
  build: {
    outDir: "dist",
    sourcemap: false,
    target: "es2022"
  },
  define: {
    __APP_API_PROXY__: JSON.stringify("https://ai-proxy.example.com/v1/generate")
  }
});
```

## Critical Play Console Gotchas
1. **Embedding GEMINI_API_KEY inside Vite client bundles via define**: Exported Google AI Studio starter ZIPs map process.env.GEMINI_API_KEY directly into client-side Vite bundles for browser prototyping. Any person or automated scanner unpacking assets/public inside your .aab extracts that plaintext key in seconds, risking runaway billing.
2. **Missing AI-generated content reporting and block controls in UI**: Google Play's AI-Generated Content policy mandates in-app user reporting or flagging controls whenever an app renders open-ended LLM text, images, or audio. Omitting a visible Report Output button causes immediate Play Console App Content policy rejections.
3. **CDN importmap scripts failing offline inside Android WebView**: AI Studio browser sandboxes frequently load React, Lucide icons, or Tailwind from esm.sh or cdn.tailwindcss.com inside index.html. Install npm dependencies locally and bundle offline assets so airplane-mode startup checks do not render a blank white screen.
4. **Omitting Data Safety disclosures for user prompts sent to Gemini**: Sending user text, voice recordings, or camera photos to a Gemini proxy constitutes off-device data transmission under Google Play's Data Safety policy. Declare encrypted transit and data handling accurately inside Play Console before submitting your Closed Testing track.

## Hardening Exported Google AI Studio Prototypes for Play Store Security

Google AI Studio enables solo builders to prototype multimodal Gemini 2.5/3.x web applications in minutes and export a ready-to-run Vite + TypeScript archive. Moving that prototype onto the Google Play Store via Capacitor 7 or Tauri 2 requires eliminating two browser-sandbox shortcuts before generating your first `.aab`: plaintext client API keys and CDN-fetched runtime modules. In AI Studio's exported `vite.config.ts`, remove any `define: { 'process.env.GEMINI_API_KEY': ... }` mapping immediately. Route all `@google/genai` calls through a server-side Cloudflare Worker, Firebase Cloud Function, or Cloud Run proxy protected by Play Integrity API verdicts or Firebase App Check attestation.
Next, inspect `index.html` for `<script type="importmap">` blocks referencing `aistudiocdn.com` or `esm.sh` as well as `<script src="https://cdn.tailwindcss.com">`. Replace runtime CDN scripts with pinned local `package.json` dependencies (`react`, `react-dom`, `@tailwindcss/vite`, `lucide-react`) compiled into `dist/` with `base: './'`. When Google Play reviewers or closed testers launch your app under spotty cellular connectivity or airplane mode, local asset bundling guarantees instant rendering and crisp offline fallback messaging rather than an unstyled white screen.
Wrap the hardened `dist/` build using Capacitor (`npx cap add android && npx cap sync android`), assign a unique reverse-DNS `applicationId` in `android/app/build.gradle`, configure `compileSdkVersion = 36` and `targetSdkVersion = 35`, and sign `app-release.aab` with a dedicated upload keystore.

## Passing Google Play's Generative AI Content & Data Safety Policies

Every Android app powered by Gemini, Claude, or OpenAI models undergoes dedicated policy scrutiny under Google Play's AI-Generated Content guidelines during Closed Testing track review. Regardless of whether your app summarizes lecture notes, coaches language learners, or generates recipes, every LLM response card must include an accessible mechanism allowing users to report offensive, inaccurate, or harmful AI generations (`Report / Thumbs Down`), backed either by a telemetry endpoint or prefilled moderation handler.
Equally important is matching your runtime network behavior to Play Console's Data Safety form. If users type text prompts, upload document PDFs, or capture photos analyzed by Gemini, declare those exact data types under Data Safety -> Data collected / shared, specify that all traffic uses HTTPS TLS encryption in transit, and provide a live web URL (plus in-app link) for account and conversation history deletion if your app authenticates users.
During GOOtester Standard ($12) and Premium ($20) campaigns, real human testers exercise your onboarding and AI prompt flows across 14 to 24 days while separate automated physical-device ARM64 ADB QA runs profile WebView RAM PSS and startup frame stability — never conflating automated ADB runs with your 12-to-25 human tester count.

## Executing a High-Signal 14-Day Closed Test for AI Apps

Personal Google Play developer accounts must complete 14 consecutive days with at least 12 opted-in human testers before applying for Production Access. Remember that GOOtester's service clock starts only after your initial `.aab` passes Play Console's Closed Testing review and your `testers@gootester.com` Google Group setup is verified live — protecting you from losing paid testing days if Google's initial AI policy review requests a Data Safety adjustment.
Use feedback gathered during Week 1 (streaming token latency indicators, markdown code-block wrapping on narrow 360dp screens, keyboard `imePadding` overlaps on prompt inputs) to ship `versionCode 2` and `versionCode 3` `.aab` updates. Documenting those concrete UX improvements gives Google Play — the sole decision-maker for Production Access — clear proof of active product maturation.
Include graceful client-side HTTP 429 rate-limit backoff banners and token-budget indicators inside your AI chat interface before Day 1 so simultaneous tester sessions never render uncaught JSON parse exceptions or blank assistant bubbles.
