AI Agent Integration Guide
AI coding agents guide for integrating Luciq on Android. Step-by-step instructions optimized for Claude Code and other agentic coding workflows.
AI Agent Integration Guide
⚠️ UNIVERSAL EXECUTION RULES ⚠️
Critical Rules - Apply to ALL Platforms:
NEVER skip WAIT instructions - always get user confirmation before proceeding
NEVER auto-execute optional steps - user must explicitly select them
ALWAYS fetch latest SDK version before integration (DO NOT use placeholders like 1.0.0)
ALL API parameters must be included (can be nil/null) - never omit parameters
Execution Guidelines:
Be specific and concise - save tokens by being to the point
Don't create documentation files - only code files required for integration
Implement mandatory steps sequentially - complete each before moving to the next
Prompt user with current step - describe what's happening, then proceed when done
Only ask for optional steps after mandatory ones - show numbered list for selection
Use numbered lists for all options - makes selection easier (e.g., "Select 1", "Select 2")
Add wrap up step - execute validation only when user selects "Wrap up & validate"
Check documentation first - confirm API availability before getting creative beyond examples
Official Documentation:
Main docs: https://docs.luciq.ai/
Always check official docs when unsure about API signatures or platform specifics
Integration Workflow Overview
Step 1 — Collect Required Information [MANDATORY]
1A: Get App Token
Check MCP Server First:
Validation:
Token should be non-empty
Typically 32-40 character hexadecimal string
If invalid format, warn user but proceed
1B: Determine Integration Method
Auto-Detection Logic:
Platform-specific detection should look for:
iOS:
Podfile,Cartfile, SPM packages in.xcodeproj, or none → ManualAndroid:
build.gradlewith repositories,pom.xml, or none → Manual
1C: Apply Default Configuration (Inform + Opt-in)
Default configuration is applied automatically. Inform the user:
Store default configuration:
If user wants to customize (yes):
If user does not want to customize (no):
Proceed to Step 2
Step 2 — Add SDK Dependency [MANDATORY - Platform-Specific]
Pre-Dependency Critical Step:
⚠️ MUST FETCH LATEST VERSION FIRST:
Then proceed to platform-specific dependency installation (see platform guides)
Step 3 — Initialize the SDK [MANDATORY - Platform-Specific]
Invocation Events Configuration
Default invocation events: [shake, floatingButton]
These are applied automatically unless the user chose to customize in Step 1C.
If user chose to customize invocation events:
Invocation Event Mapping:
none→ Empty array[]Single selection →
[selected]Multiple →
[event1, event2, ...]
Apply configuration in platform-specific syntax (see platform guides)
Step 4 — Configure Network Logging [MANDATORY]
Concepts (Platform-Agnostic):
Purpose: Automatically capture network requests/responses and optionally mask sensitive data
Part A: Network Capture
Part B: Mask Sensitive Data
Implementation Requirements:
Masking code MUST be placed AFTER SDK initialization
Headers: Simple loop through header names
Body: Recursive function to handle nested JSON at any depth
Performance: Use Set/HashSet for O(1) field lookup
Step 5 — Mask Repro Step Screenshots [MANDATORY]
Concepts (Platform-Agnostic):
Purpose: Automatically blur/mask sensitive UI elements in screenshot repro steps
Default Configuration:
iOS:
maskNothing(with guidance comments for customization)Android: All types (
textInputs,labels,media)
If user chose to customize in Step 1C:
Available Mask Types:
iOS:
.textInputs: Text input fields, password fields.labels: Text labels, buttons with text.media: Comprehensive masking (includes all types).maskNothing: No automatic masking (default)
Android:
MaskingType.TEXT_INPUTS: Text input fields, password fieldsMaskingType.LABELS: Text labels, buttons with textMaskingType.MEDIA: Images, media contentMaskingType.MASK_NOTHING: Disable auto masking
Step 6 — Upload Symbolication Files [MANDATORY]
Concepts (Platform-Agnostic):
Purpose: Upload debug symbols (dSYM for iOS, mapping files for Android) for crash symbolication. This is required for readable crash reports.
iOS (dSYM Upload):
Detection-based approach:
See ios-guide.md for implementation details.
Android (Mapping File Upload):
Default: Gradle task (automatic)
See android-guide.md for implementation details.
Customization Options:
🛑 MANDATORY STEPS COMPLETE - STOP HERE
Optional Steps Menu
After all mandatory steps are complete, display:
Optional Step 1 — Configure Repro Steps Mode
Concepts (Platform-Agnostic):
Purpose: Control which products include screenshots in their repro steps
Default Behavior:
Bug Reporting: Screenshots enabled
Crash Reporting: Screenshots disabled
Session Replay: Screenshots enabled
Issue Type Mapping:
Bug Reporting →
.bug/IssueType.BugCrash Reporting →
.allCrashes/IssueType.AllCrashesSession Replay →
.sessionReplay/IssueType.SessionReplayAll products →
.all/IssueType.All
Optional Step 2 — Add User Identification
Concepts (Platform-Agnostic):
Purpose: Link bug reports to specific user accounts for better tracking
Step 3A: Identify Login Flows
Search Strategy:
Search for authentication/login methods in codebase
Look for successful login callbacks/handlers
Identify where user data becomes available
Placement Rules:
Add identification AFTER authentication succeeds
Add BEFORE any navigation/routing
Ensure user data (email/id/name) is available at this point
API Signature (All Platforms):
Examples by Selection:
Option 1 (email):
identifyUser(null, user.email, user.name)Option 2 (ID):
identifyUser(user.id, null, user.name)Option 3 (both):
identifyUser(user.id, user.email, user.name)
Platform-Specific Syntax: See platform guides
Step 3B: Identify Logout Flows
Search Strategy:
Search for logout/signout methods in codebase
Look for session clearing logic
Identify where user data is removed
Placement Rules:
Add logout call BEFORE clearing user session/data
Ensure it's called on all logout paths
API Signature (All Platforms):
Platform-Specific Syntax: See platform guides
Step 7 — Verification & Testing (Wrap up & validate) [USER-INITIATED ONLY]
⚠️ CRITICAL: This step is ONLY executed when the user explicitly selects "Wrap up & validate" from the optional steps menu. Do NOT run automatically after mandatory steps complete.
After Mandatory Steps Complete
Display this summary and menu:
WAIT for user selection. Do NOT proceed to build verification unless user selects option 2.
1. Build Verification [ONLY WHEN USER REQUESTS]
Execute platform-specific build command:
iOS:
xcodebuild -project ... -scheme ... buildAndroid:
./gradlew assembleDebug
Expected Result: BUILD SUCCEEDED with no errors
Common Build Errors & Solutions:
"no such module" / "unresolved import"
Wrong import statement
Check platform guide for correct import
"version not found"
Invalid SDK version
Verify version fetched from releases
"package not resolved"
Dependency not added
Re-run package manager sync
2. Runtime Testing [MANUAL]
After successful build, instruct user to perform these steps:
3. Final Summary [DISPLAY AFTER BUILD SUCCESS]
Generate and display summary after successful validation:
Error Handling & Troubleshooting
Common Issues Across Platforms:
1. SDK Not Initializing:
Verify token is correct
Check initialization code placement (usually in app entry point)
Ensure import statement is correct
2. Network Logging Not Working:
Verify masking code placed AFTER SDK initialization
Check that network interceptor is properly configured
Ensure app has network permissions
3. User Identification Not Showing:
Verify identifyUser called after successful login
Check that logout is called on all logout paths
Ensure parameters are not all null
4. Reports Not Appearing in Dashboard:
Verify device/simulator has internet connection
Check app token is correct
Wait a few minutes for sync
Check dashboard filters
Extension Points for Platform Guides
Platform-specific guides should include:
Required Sections:
Platform-Specific Critical Rules (import naming, package names, etc.)
Pre-Integration Checklist (platform-specific gotchas)
Step 2 Implementation (dependency management code)
Step 3 Implementation (SDK initialization code)
Step 4 Implementation (network logging code) [MANDATORY]
Step 5 Implementation (screenshot masking code) [MANDATORY]
Step 6 Implementation (symbolication upload code) [MANDATORY]
Optional Step 1 Implementation (repro steps mode)
Optional Step 2 Implementation (user identification code)
Step 7 Implementation (build commands, platform-specific testing)
Reference Format:
Luciq SDK Integration - Android Guide
Purpose: Android-specific implementation details for Luciq SDK integration. This guide provides Android-specific code, configuration, and platform requirements.
⚠️ ANDROID-SPECIFIC CRITICAL RULES ⚠️
Package and Import:
Gradle Dependency:
implementation 'ai.luciq.library:luciq:<VERSION>'Import Statement:
import ai.luciq.library.LuciqLanguage: Code examples in Kotlin (Java equivalents straightforward)
Minimum Requirements: compileSdkVersion 29 or above
Android 15+ (API 35): Requires Luciq 13.4.0+ for 16KB page size support
Android-Specific Execution Rules:
Initialize in Application class (not Activity)
Network interception: MANDATORY - Configure in Step 3B (Gradle plugin auto-instruments OkHttp/UrlConnection)
APM provides: App launch, network performance, UI hangs, screen loading metrics
At least email OR id required for user identification (both null = error)
Use exact version in gradle (not
+or ranges)ALL API parameters must be included (can be
null)
Official Android Documentation:
Android Integration: https://docs.luciq.ai/docs/android-integration
APM Migration: https://docs.luciq.ai/docs/android-luciq-migration
User Identification: https://docs.luciq.ai/docs/android-identify-user
Network Logging: https://docs.luciq.ai/reference/network-logging-android
Screenshot Masking: https://docs.luciq.ai/docs/android-repro-steps
Unified Network Interceptor: https://docs.luciq.ai/docs/android-unified-network-interception
ANDROID-SPECIFIC IMPLEMENTATION DETAILS
Pre-Integration Checklist
Before starting, verify you understand these Android-specific points:
Step 1 — Collect Required Information [MANDATORY]
📋 Workflow: See common-workflow.md - Step 1
Android-Specific Implementation
Package Manager Detection:
Check for:
build.gradle/build.gradle.kts→ Gradlepom.xml→ Maven
Integration Method Menu (if multiple/none detected):
Gradle (Recommended)
Maven
1C: Apply Default Configuration (Inform + Opt-in)
📋 Workflow: See common-workflow.md - Step 1C
For Android:
Default configuration is applied automatically (shake + floatingButton, APM enabled, network masking, etc.)
User is informed of defaults and can opt-in to customize
If user customizes: Use the customization loop (select → apply → redisplay → confirm)
apm_enabledis set totrueby defaultAfter configuration: Continue to Step 1D
1D: APM (Application Performance Monitoring)
Check Configuration Mode:
Step 2 — Add the Luciq SDK Dependency [MANDATORY]
📋 Workflow: See common-workflow.md - Step 2 Fetch latest version from GitHub API: https://api.github.com/repos/luciqai/luciq-android-sdk/releases/latest Extract version from the "tag_name" field. DO NOT hardcode versions like "18.0.0".
Android Implementation
Check Configuration Mode:
Part A: Gradle Plugins
If integration_method == gradle:
⚠️ Firebase Plugin Order: If project uses Firebase Performance Monitoring, ensure Luciq plugins are declared BEFORE Firebase:
Part B: Add Dependencies
Base Dependencies (Always Required):
APM Dependencies (If config_mode == default OR apm_enabled == true):
Maven (If integration_method == maven):
Automatic Permissions: SDK adds these to AndroidManifest.xml automatically:
Step 3 — Initialize the SDK [MANDATORY]
📋 Workflow: See common-workflow.md - Step 3
Android Implementation
⚠️ IMPORTANT: The SDK initialization MUST be the FIRST code executed in onCreate() (immediately after super.onCreate()). This ensures Luciq captures all app activity from the very start.
Part A: Detect or Create Application Class
Search for Existing Application Class:
Part B: Initialize Luciq SDK
If NO existing Application class - Create new:
Then register in AndroidManifest.xml:
If existing Application class - Update onCreate():
Part C: APM Configuration (If config_mode == default OR apm_enabled == true)
If APM is enabled, configure APM plugin in build.gradle:
⚠️ IMPORTANT: The APM plugin's networkEnabled captures network data for APM performance monitoring only. You MUST still add the OkHttp interceptor manually (see Optional Step 1) for network logs to appear in bug reports.
Note: Network logging is handled automatically by the unified network interception. Enable it in the luciq block with networkInterception { enabled = true }.
Invocation Events Syntax:
Default invocation events: SHAKE, FLOATING_BUTTON
Available Events:
LuciqInvocationEvent.SHAKE- Device shakeLuciqInvocationEvent.SCREENSHOT- Screenshot captureLuciqInvocationEvent.FLOATING_BUTTON- Floating button overlayLuciqInvocationEvent.NONE- Manual only
Step 3B — Configure Network Interception [MANDATORY]
Android Implementation (Unified Network Interception)
Minimum SDK Version: 19.0.0+
The Luciq Gradle Plugin automatically instruments OkHttp and UrlConnection networking libraries. No manual interceptor setup required!
Configuration Settings
networkInterception.enabled
false
Master switch for interception
okHttp.enabled
true
OkHttp automatic integration
urlConnection.enabled
true
UrlConnection automatic integration
okHttp.legacyApmInterceptionEnabled
true
APM legacy interceptor fallback
urlConnection.legacyInterceptionEnabled
true
Core legacy interceptor fallback
Part A: Enable Network Interception (Gradle Plugin)
Kotlin DSL (build.gradle.kts):
Groovy (build.gradle):
Note: Legacy interceptors will be removed in a future major release. Disabling them now ensures smooth future upgrades.
Part B: Selective Library Instrumentation (Optional)
If you need to disable instrumentation for specific libraries:
Part C: Mask Sensitive Data
Use the centralized Luciq.setNetworkLogListener for all captured logs:
Key Points:
Headers: Mask with "*****" (preserves header presence for debugging)
Body fields: Recursive masking at any depth using Set for O(1) lookup
Return
nullto exclude log entirely
Step 4 — Mask Repro Step Screenshots [MANDATORY]
📋 Workflow: See common-workflow.md - Optional Step 1
Android Implementation
Minimum SDK Version: 11.13.0
Check Configuration Mode:
Build-time Configuration (Alternative):
Additional Privacy Controls:
Available Masking Types:
MaskingType.TEXT_INPUTS- EditText, TextInputLayout, text input fieldsMaskingType.LABELS- TextView, Button text, labels, titlesMaskingType.MEDIA- ImageView, VideoView, images and videoMaskingType.MASK_NOTHING- Disable all auto masking
Key Notes:
Private Views API takes precedence over Auto Masking
Works with Bug Reporting, Crash Reporting, and Session Replay
Screenshots are disabled by default for Crash Reporting
Step 5 — Upload Mapping Files [MANDATORY]
📋 Workflow: See common-workflow.md - Step 6
Android Implementation
This step is required for readable crash reports.
Purpose: Upload ProGuard/R8 mapping files for crash symbolication.
Part A: Create Upload Script
Create upload_mapping.sh in your project root:
Part B: Add Gradle Task
Add to your app's build.gradle or build.gradle.kts:
Kotlin DSL (build.gradle.kts):
Groovy (build.gradle):
Part C: Run After Release Build
Alternative: Manual Dashboard Upload
Navigate to Upload Mapping Files in your Luciq dashboard Settings
Upload your
mapping.txtfile (found inapp/build/outputs/mapping/release/)Upload for each release version
🛑 MANDATORY STEPS COMPLETE
Optional Step 1 — Configure Repro Steps Mode
📋 Workflow: See common-workflow.md - Optional Step 1
Android Implementation
Based on user selections, apply configuration:
Issue Type Options:
IssueType.Bug- Bug ReportingIssueType.AllCrashes- Crash ReportingIssueType.SessionReplay- Session ReplayIssueType.All- All products
Key Points:
Selected products →
ReproMode.EnableWithScreenshotsNon-selected products →
ReproMode.EnableWithNoScreenshots
Optional Step 2 — Add User Identification
📋 Workflow: See common-workflow.md - Optional Step 2
Android Implementation - Login Flow
API Signature:
⚠️ CRITICAL: At least email OR id must be non-null. All null throws error.
Examples:
Email only:
Luciq.identifyUser(user.name, user.email, null)ID only:
Luciq.identifyUser(user.name, null, user.id)Both:
Luciq.identifyUser(user.name, user.email, user.id)
Additional User Data (optional):
Android Implementation - Logout Flow
Note: logoutUser() only works if user was previously identified
Step 6 — Verification & Testing [WRAP UP & VALIDATE]
📋 Workflow: See common-workflow.md - Step 7
Android Build Verification
Expected: BUILD SUCCESSFUL
Android-Specific Build Errors:
compileSdkVersion < 29
SDK too old
Set compileSdkVersion to 29+
Unresolved reference: Luciq
Missing dependency
Sync gradle, verify version
Duplicate class
Dependency conflict
Check: ./gradlew dependencies
Android Runtime Testing
Install and run:
Trigger Luciq:
Shake: Shake device/emulator
Screenshot: Power + Volume Down
Floating Button: Tap button overlay
Verify Luciq UI appears
Submit test report
Check dashboard: https://dashboard.luciq.ai
Android-Specific Troubleshooting
Issue: "compileSdkVersion must be >= 29"
Fix: Update build.gradle:
Issue: Network logs not appearing
Fix: Enable unified network interception in luciq { networkInterception { enabled = true } }
Issue: Application class not registered
Fix: Add android:name=".MyApplication" to <application> tag in manifest
Issue: User identification error
Fix: Ensure at least email OR id is non-null (not both null)
Issue: Screenshots not masking
Fix: Use setAutoMaskScreenshotsTypes(MaskingType.TEXT_INPUTS, MaskingType.LABELS)
Quick Reference
Java Equivalents
All Kotlin examples have straightforward Java equivalents:
val→finalLambda
{ }→ Anonymous inner class?.let→ null check withifExtension functions → Static utility methods
Refer to official docs for Java examples if needed.
Last updated