The Ultimate Mobile XR Development Environment - Now on Android!
XRAiAssistant Android is a revolutionary AI-powered Extended Reality development platform that combines Babylon.js, Together AI, and native Android development into the ultimate mobile XR development environment with advanced AI assistance capabilities.
Complete feature parity with iOS version using Kotlin, Jetpack Compose, and modern Android architecture.
- Multi-Provider Support: Together.ai, OpenAI, Anthropic
- Streaming Responses: Real-time AI generation with progress indicators
- Advanced Parameter Control: Temperature & Top-p with intelligent descriptions
- 6+ AI Models: DeepSeek R1, Llama 3.3, GPT-4o, Claude 3.5 Sonnet, and more
- Babylon.js - Full-featured WebGL engine
- Three.js - Popular 3D library
- A-Frame - WebVR framework
- React Three Fiber - React + Three.js declarative
- Reactylon - React + Babylon.js declarative
- Automatic sandbox creation for R3F and Reactylon
- Live preview and hot reload
- One-tap deployment
- Share sandboxes instantly
- Conversation history with Room database
- Settings stored in DataStore
- Offline-ready architecture
- Auto-save functionality
- Automatic code extraction from AI responses
- Babylon.js API error correction
- TypeScript to JavaScript conversion
- React component validation
┌─────────────────────────────────────┐
│ Presentation Layer │
│ Compose UI → ViewModels → State │
└──────────────┬──────────────────────┘
│
┌──────────────┴──────────────────────┐
│ Domain Layer │
│ Use Cases → Repositories (I) │
└──────────────┬──────────────────────┘
│
┌──────────────┴──────────────────────┐
│ Data Layer │
│ Repositories (Impl) → Data Sources │
└─────────────────────────────────────┘
- Language: Kotlin 1.9.20
- UI: Jetpack Compose 1.5.4 + Material 3
- DI: Hilt 2.48
- Networking: Retrofit 2.9 + OkHttp 4.11
- Database: Room 2.6.0
- Settings: DataStore 1.0.0
- Testing: JUnit 5, Mockk, Turbine
- Android Studio: Hedgehog (2023.1.1) or later
- JDK: 17 or later
- Minimum Android: API 26 (Android 8.0)
- Target Android: API 34 (Android 14)
-
Clone the repository
cd XRAiAssistant/XRAiAssistantAndroid -
Open in Android Studio
- File → Open → Select
XRAiAssistantAndroidfolder - Wait for Gradle sync to complete
- File → Open → Select
-
Build the project
./gradlew build
-
Run on device/emulator
- Click "Run" or use
./gradlew installDebug
- Click "Run" or use
-
Configure API Keys
- Launch app on device/emulator
- Tap Settings (⚙️) in bottom navigation
- Enter your Together.ai API key (required)
- Optional: Add OpenAI or Anthropic keys
- Tap "Save"
com.xrai.assistant/
├── di/ # Dependency Injection
│ ├── AppModule.kt
│ ├── NetworkModule.kt
│ └── DatabaseModule.kt
│
├── data/ # Data Layer
│ ├── remote/ # API clients
│ │ ├── TogetherAiService.kt
│ │ ├── OpenAiService.kt
│ │ ├── AnthropicService.kt
│ │ └── CodeSandboxService.kt
│ ├── local/ # Local storage
│ │ ├── dao/
│ │ ├── database/
│ │ └── datastore/
│ └── repository/ # Repository implementations
│ ├── ChatRepositoryImpl.kt
│ └── SettingsRepositoryImpl.kt
│
├── domain/ # Domain Layer
│ ├── model/ # Domain models
│ │ ├── ChatMessage.kt
│ │ ├── AIProvider.kt
│ │ ├── AIModel.kt
│ │ └── Library3D.kt
│ ├── repository/ # Repository interfaces
│ │ ├── ChatRepository.kt
│ │ └── SettingsRepository.kt
│ └── usecase/ # Use cases
│ ├── SendMessageUseCase.kt
│ └── CreateSandboxUseCase.kt
│
├── presentation/ # Presentation Layer
│ ├── screens/
│ │ ├── chat/
│ │ │ ├── ChatScreen.kt
│ │ │ └── ChatViewModel.kt
│ │ ├── scene/
│ │ │ ├── SceneScreen.kt
│ │ │ └── SceneViewModel.kt
│ │ └── settings/
│ │ ├── SettingsScreen.kt
│ │ └── SettingsViewModel.kt
│ ├── navigation/
│ │ ├── NavGraph.kt
│ │ └── NavigationDestinations.kt
│ └── theme/
│ ├── Color.kt
│ ├── Theme.kt
│ └── Type.kt
│
└── util/ # Utilities
├── CodeExtractor.kt
├── TypeScriptCleaner.kt
└── BabylonJSFixer.kt
# Debug build
./gradlew assembleDebug
# Release build
./gradlew assembleRelease
# Run tests
./gradlew test
# Run UI tests
./gradlew connectedAndroidTest# Run linter
./gradlew lint
# Check code style
./gradlew ktlintCheck
# Format code
./gradlew ktlintFormat- Unit Tests: 80%+ coverage
- UI Tests: All critical user flows
- Integration Tests: All API clients
# All unit tests
./gradlew test
# Specific test class
./gradlew test --tests ChatViewModelTest
# All instrumentation tests
./gradlew connectedAndroidTest
# Generate coverage report
./gradlew jacocoTestReportapp/src/test/ # Unit tests
├── viewmodel/
│ └── ChatViewModelTest.kt
├── usecase/
│ └── SendMessageUseCaseTest.kt
└── repository/
└── ChatRepositoryTest.kt
app/src/androidTest/ # Instrumentation tests
├── ui/
│ ├── ChatScreenTest.kt
│ └── SettingsScreenTest.kt
└── database/
└── MessageDaoTest.kt
| iOS (Swift/SwiftUI) | Android (Kotlin/Compose) |
|---|---|
@ObservableObject |
@HiltViewModel |
@Published var |
StateFlow<T> |
struct ContentView: View |
@Composable fun ContentView() |
@State private var text = "" |
var text by remember { mutableStateOf("") } |
TextField("Prompt", text: $text) |
TextField(value = text, onValueChange = { text = it }) |
List { ForEach(items) { } } |
LazyColumn { items(items) { } } |
UserDefaults |
DataStore |
URLSession |
Retrofit + OkHttp |
async/await |
suspend fun with Coroutines |
WKWebView |
WebView |
- State Management:
@Published→StateFlow - UI: SwiftUI → Jetpack Compose
- DI: Property wrappers → Hilt annotations
- Networking: URLSession → Retrofit
- Storage: UserDefaults → DataStore, CoreData → Room
- Project structure
- Gradle configuration
- Version catalog with all dependencies
- Navigation setup
- Material 3 theming
- Domain models (ChatMessage, AIProvider, AIModel, Library3D)
- Application class with Hilt
- MainActivity with Compose
- Bottom navigation
- Theme (Color, Type, Theme)
- TogetherAiService implementation
- OpenAiService implementation
- AnthropicService implementation
- ChatRepository
- ChatViewModel
- Streaming responses with Flow
- Message persistence with Room
- Chat UI (message list, input field)
- Markdown rendering
See ANDROID_IMPLEMENTATION_PLAN.md for complete roadmap.
- Follow Kotlin coding conventions
- Use ktlint for formatting
- Write KDoc comments for public APIs
- Include unit tests for new features
- Create feature branch from
main - Implement changes with tests
- Run
./gradlew ktlintFormat test - Submit PR with description
Copyright © 2024 XRAiAssistant
See LICENSE file for details.
- iOS Version: ../XRAiAssistant/
- Implementation Plan: ../ANDROID_IMPLEMENTATION_PLAN.md
- Together.ai API: https://together.ai
- OpenAI API: https://platform.openai.com
- Anthropic API: https://console.anthropic.com
For issues, questions, or feature requests:
- Open an issue on GitHub
- Check the Implementation Plan
- Review iOS implementation for reference
Built with ❤️ using Kotlin, Jetpack Compose, and AI