0

I am facing OutofMemoryError exception, when I try to convert the json response to string

Here is the code I tried

 HttpEntity entity = response.getEntity();
 if(entity != null) {
    contentAsString = EntityUtils.toString(entity); // error
 }

I tried with volley and Retrofit Network libraries as well but facing the same issue. Pls suggest...

Aristo Michael
  • 2,166
  • 3
  • 35
  • 43

2 Answers2

0

Try this

Set the largeHeap="true" in your AndroidManifest.xml

  <application
        android:icon="@drawable/app_icon"
        android:largeHeap="true"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

Let me know if this works for you! :)

Vivek Bhardwaj
  • 530
  • 5
  • 16
0

Add this to your manifest

android:largeHeap="true"
MinnuKaAnae
  • 1,646
  • 3
  • 23
  • 35