Android - Fatal Exception: java.lang.IllegalStateException | Community
Skip to main content

We are encountering crashes on Android devices related to Intercom SDK version 15.9.1.

 

Stack Trace:

Failed to build unique file: /storage/emulated/0/DCIM/vr-unit.gif bucket_display_name=DCIM volume_name=external_primary date_modified=null date_expires=null _display_name=vr-unit.gif mime_type=image/gif _data=/storage/emulated/0/DCIM/vr-unit.gif _size=null is_trashed=0 is_pending=0 bucket_id=-2075821635 relative_path=DCIM/
 

android.content.ContentResolver.update (ContentResolver.java:2318)

arrow_right

io.intercom.android.sdk.ui.preview.viewmodel.PreviewViewModel.saveImageOnApi29Above (PreviewViewModel.kt:201)

io.intercom.android.sdk.ui.preview.viewmodel.PreviewViewModel.access$saveImageOnApi29Above (PreviewViewModel.kt:35)

io.intercom.android.sdk.ui.preview.viewmodel.PreviewViewModel$saveImage$1.invokeSuspend (PreviewViewModel.kt:92)

kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)

 

Device : Mostly Google Pixel

Android Version: 11, 12

Hey ​@Mayur, Emily here from Support Engineering at Intercom 👋🏼

 

Based on the stack trace, this crash appears to be related to image handling in the Intercom Android SDK, specifically when trying to save a GIF file to the device's storage. The error is occurring in the PreviewViewModel class when attempting to save an image using saveImageOnApi29Above method, which is trying to update a content URI through Android's ContentResolver. This looks like an issue with file permissions or storage access when the SDK is trying to save a GIF file to the device's DCIM directory.

 

The error message "Failed to build unique file" suggests there might be a problem with:

1. Storage permissions - The app might not have proper permissions to write to external storage
2. File naming conflicts - The SDK might be trying to save a file that already exists
3. Storage space limitations - The device might be out of storage space
4. Android version compatibility - The code path specifically mentions "Api29Above" which indicates it's using Android 10+ storage access methods

To resolve this issue, I'd recommend:

1. Ensure the app has requested and been granted the appropriate storage permissions
2. Check if the device has sufficient storage space
3. Consider updating to the latest version of the Intercom SDK
4. Make sure you're following our integration guidelines for file handling