> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> CometChat Calling SDK v5 - Troubleshooting for Android

## Installation & Setup

| Symptom                 | Cause                                         | Fix                                                                                                           |
| ----------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Gradle sync fails       | Repository not added or version mismatch      | Ensure `maven { url 'https://dl.cloudsmith.io/public/cometchat/cometchat/maven/' }` is in your `build.gradle` |
| `init()` fails silently | Invalid App ID or Region                      | Double-check credentials from the [CometChat Dashboard](https://app.cometchat.com/)                           |
| Duplicate class errors  | Conflicting WebRTC or transitive dependencies | Exclude conflicting modules in your `build.gradle` dependencies block                                         |
| `minSdkVersion` error   | SDK requires higher minimum API level         | Set `minSdkVersion` to 21 or higher                                                                           |

***

## Authentication

| Symptom                          | Cause                          | Fix                                                                                                     |
| -------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------- |
| `login()` fails with invalid UID | UID doesn't exist in CometChat | Create the user via [Dashboard](https://app.cometchat.com/) or [REST API](/rest-api/users/create) first |
| Auth token expired               | Token has a limited lifetime   | Generate a new auth token and call `login()` again                                                      |
| `login()` called before `init()` | SDK not initialized            | Always call `init()` and wait for the callback before calling `login()`                                 |

***

## Joining a Session

| Symptom                          | Cause                                    | Fix                                                                       |
| -------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------- |
| `generateToken()` fails          | User not logged in or invalid session ID | Ensure `login()` completes before generating a token                      |
| Session joins but no audio/video | Runtime permissions not granted          | Request `CAMERA` and `RECORD_AUDIO` permissions at runtime before joining |
| `joinSession()` throws error     | Invalid or expired token                 | Generate a fresh token using `generateToken()` before joining             |

***

## Audio & Video

| Symptom                           | Cause                                  | Fix                                                                                |
| --------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------------- |
| No audio from remote participants | Audio routing issue                    | Check [Audio Modes](/calls/android/audio-modes) for speaker/earpiece configuration |
| Camera not working                | Permission denied or hardware issue    | Verify `CAMERA` permission is granted and camera is not in use by another app      |
| Echo or feedback                  | Speaker mode with no echo cancellation | Use earpiece mode or headphones                                                    |

***

## Background & VoIP

| Symptom                                | Cause                                   | Fix                                                                                                                  |
| -------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| Call drops when app goes to background | No foreground service                   | Implement a foreground service to keep the call alive. See [Background Handling](/calls/android/background-handling) |
| VoIP notifications not working         | FCM not configured                      | Set up Firebase Cloud Messaging. See [VoIP Calling](/calls/android/voip-calling)                                     |
| App killed by OS during call           | Missing foreground service notification | Show a persistent notification during active calls                                                                   |

***

## Picture-in-Picture

| Symptom                     | Cause                      | Fix                                                                                     |
| --------------------------- | -------------------------- | --------------------------------------------------------------------------------------- |
| PiP not working             | Missing manifest attribute | Add `android:supportsPictureInPicture="true"` to your activity in `AndroidManifest.xml` |
| PiP not available on device | Android version below 8.0  | PiP requires Android 8.0 (API 26) or higher                                             |
