OutOfMemory Error

Hi Intercom,
I received following crash report on Crashlytic but I don’t have any information how to reproduce this crash… Need help on this issue :pray:t2:
Intercom version = “5.+”

Thank you!

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 31961100 byte allocation with 4193776 free bytes and 26MB until OOM
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at android.graphics.BitmapFactory.nativeDecodeStream(BitmapFactory.java)
       at android.graphics.BitmapFactory.decodeStreamInternal + 677(BitmapFactory.java:677)
       at android.graphics.BitmapFactory.decodeStream + 653(BitmapFactory.java:653)
       at android.graphics.BitmapFactory.decodeStream + 691(BitmapFactory.java:691)
       at android.provider.MediaStore$Images$Media.getBitmap + 1133(MediaStore.java:1133)
       at io.intercom.android.sdk.blocks.NetworkImage.loadImageFromUrl + 131(NetworkImage.java:131)
       at io.intercom.android.sdk.blocks.NetworkImage.addImage + 98(NetworkImage.java:98)
       at io.intercom.android.sdk.blocks.BlockType$12.generateViewFromBlockAndLayout + 85(BlockType.java:85)
       at io.intercom.android.sdk.blocks.BlockType.getView + 162(BlockType.java:162)
       at io.intercom.android.sdk.blocks.Blocks.createBlocks + 34(Blocks.java:34)
       at io.intercom.android.sdk.conversation.ConversationContentPresenter.addViewForPart + 449(ConversationContentPresenter.java:449)
       at io.intercom.android.sdk.conversation.ConversationContentPresenter.newTriggerConversationSuccess + 878(ConversationContentPresenter.java:878)
       at java.lang.reflect.Method.invoke(Method.java)
       at io.intercom.com.squareup.otto.EventHandler.handleEvent + 89(EventHandler.java:89)
       at io.intercom.com.squareup.otto.Bus.dispatch + 385(Bus.java:385)
       at io.intercom.com.squareup.otto.Bus.dispatchQueuedEvents + 368(Bus.java:368)
       at io.intercom.com.squareup.otto.Bus.post + 337(Bus.java:337)
       at io.intercom.android.sdk.MainThreadBus.post + 18(MainThreadBus.java:18)
       at io.intercom.android.sdk.api.CallbackHolder.conversationFetchSuccess + 155(CallbackHolder.java:155)
       at io.intercom.android.sdk.api.CallbackHolder.access$000 + 31(CallbackHolder.java:31)
       at io.intercom.android.sdk.api.CallbackHolder$4.onSuccess + 84(CallbackHolder.java:84)
       at io.intercom.android.sdk.api.CallbackHolder$4.onSuccess + 82(CallbackHolder.java:82)
       at io.intercom.android.sdk.api.BaseCallback.onResponse + 32(BaseCallback.java:32)
       at io.intercom.retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1$1.run + 83(DefaultCallAdapterFactory.java:83)
       at android.os.Handler.handleCallback + 815(Handler.java:815)
       at android.os.Handler.dispatchMessage + 104(Handler.java:104)
       at android.os.Looper.loop + 207(Looper.java:207)
       at android.app.ActivityThread.main + 5765(ActivityThread.java:5765)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 789(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main + 679(ZygoteInit.java:679)

Another crash, but this one doesn’t happen often

Fatal Exception: java.lang.ArithmeticException: divide by zero
           at io.intercom.android.sdk.api.ProgressRequestBody.writeTo + 56(ProgressRequestBody.java:56)
           at io.intercom.okhttp3.MultipartBody.writeOrCountBytes + 173(MultipartBody.java:173)
           at io.intercom.okhttp3.MultipartBody.writeTo + 114(MultipartBody.java:114)
           at io.intercom.okhttp3.internal.http.CallServerInterceptor.intercept + 72(CallServerInterceptor.java:72)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 147(RealInterceptorChain.java:147)
           at io.intercom.okhttp3.internal.connection.ConnectInterceptor.intercept + 45(ConnectInterceptor.java:45)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 147(RealInterceptorChain.java:147)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 121(RealInterceptorChain.java:121)
           at io.intercom.okhttp3.internal.cache.CacheInterceptor.intercept + 93(CacheInterceptor.java:93)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 147(RealInterceptorChain.java:147)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 121(RealInterceptorChain.java:121)
           at io.intercom.okhttp3.internal.http.BridgeInterceptor.intercept + 93(BridgeInterceptor.java:93)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 147(RealInterceptorChain.java:147)
           at io.intercom.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept + 126(RetryAndFollowUpInterceptor.java:126)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 147(RealInterceptorChain.java:147)
           at io.intercom.okhttp3.internal.http.RealInterceptorChain.proceed + 121(RealInterceptorChain.java:121)
           at io.intercom.okhttp3.RealCall.getResponseWithInterceptorChain + 250(RealCall.java:250)
           at io.intercom.okhttp3.RealCall$AsyncCall.execute + 201(RealCall.java:201)
           at io.intercom.okhttp3.internal.NamedRunnable.run + 32(NamedRunnable.java:32)
           at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
           at java.lang.Thread.run + 764(Thread.java:764)

Hey @luluthecat :wave:

Taking a look at your first error and it sounds like BitmapFactory ran into an issue when our SDK tried to load an image.

I did some digging and found this explanation of the error:

If possible let us know if adding android:hardwareAccelerated="false" and android:largeHeap="true" to your manifest file fixes this.

Looking through past reports and we maybe get one report of this a year so it doesn’t look like it’s a widespread issue. If any other mobile developers run into this then feel free to let us know here and if updating your manifest file worked for you :+1:

As for the second error I can’t find any other reports of it or what could be causing it :thinking: I’ll flag this with our mobile team to see if we can shed more light into what may be going on here.