Skip to content

Conversation

@divyanshsaraswat
Copy link

PR: feat(android): Implement Native A2UI Renderer & Interactive Contact Lookup Sample

Description

Implemented the initial version of the Android native renderer for the A2UI protocol and updated the sample client to verify its functionality against the contact_lookup agent.

Changes

Android Renderer (renderers/android)

  • Core Components: Implemented ReflectiveIconRenderer to dynamically load standard and extended Material Icons by name. Added DividerRenderer and ImageRenderer (using Coil).
  • Dynamic Loading: Added kotlin-reflect and material-icons-extended dependencies to support the full range of A2UI icons without hardcoding.
  • Registry: Updated ComponentRegistry to map JSON types (e.g., "Icon", "Divider") to their Compose counterparts.

Sample Application (samples/client/android)

  • Interactive UI: Refactored MainActivity to include a standard text input and send button, enabling real-time user-agent interaction.
  • Robust Networking: Fixed JSON-RPC protocol issues (previously using incorrect method names) and implemented manual JSON parsing to handle polymorphic ServerMessage types correctly.
  • Environment Fixes: Added URL rewriting (localhost -> 10.0.2.2) for emulator compatibility and increased Gradle heap size to 4GB to prevent OOM errors.
  • Documentation: Updated README.md with clear setup and running instructions.

Verification

  • ✅ Verified against the local contact_lookup agent.
  • ✅ Confirmed rendering of complex layouts (Columns, Rows, Cards), text, images, and dynamic icons.
  • ✅ Validated interactive query flow ("Find contact info...").
image image

Introduces a native Android renderer for the A2UI protocol using Kotlin and Jetpack Compose.
Key changes:
- Added 
enderers/android:
  - �2ui-core: Pure Kotlin module for protocol data models, state management, and JSON parsing.
  - �2ui-compose: Android Library module implementing A2UISurface and Material Design 3 component renderers.
- Added samples/client/android:
  - Sample application demonstrating how to integrate the renderer using a Gradle composite build.
- Implemented support for MVP components: Column, Row, Box, Text, Button, TextField, Image.
- Updated .gitignore to include Android and Gradle build artifacts.
- Added usage documentation and architecture overview.
- Added A2AClient.kt for native Kotlin-based agent communication using OkHttp.

- Updated MainActivity.kt to connect directly to the contact lookup agent.

- Implemented missing A2UI components in a2ui-compose: Checkbox, Slider, Card, Tabs, Modal, DateTimeInput, Video.

- Updated a2ui-core data models to support the new components.

- Added ANDROID_GUIDE.md documentation.
Major improvements to the Android A2UI client to resolve blank screen issues and enhance UI rendering.
Key Changes:
- **Fix JSON-RPC**: Corrected method name to message/send and fixed serialization logic to handle polymorphic ServerPart correctly.
- **Fix UI Rendering**:
    - Implemented IconRenderer with reflection to support all Material Icons dynamically.
    - Added DividerRenderer to support separator lines.
    - Integrated Coil for image loading and added localhost->10.0.2.2 URL rewriting for emulator.
- **Stability**:
    - Increased OKHttp timeout to 90s.
    - Increased Gradle JVM heap size to 4GB to prevent OOM during build.
- **Documentation**:
    - Updated Android client README with setup instructions.
    - Cleaned up build logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant