title: How to increase heap size of Android Application?
body: <blockquote>
    <p>Hi, I am performing animation in android application. When running the my application is crash and getting OutOfMemoryException. The error are,
    java.lang.OutOfMemoryError: Failed to allocate a 9437196 byte allocation with 3044192 free bytes and 2MB until OOM</p>
  </blockquote>
  
  <p>I tried to add largeHeap=true statement in my manifeast file, but this is not the right solution. So, please help me for solving this above problem. Thank you.</p>
  
  <p>My Logcat are given below,</p>
  
  <pre><code>8:05.256 9298-9298/ayurjanaapp.dell.xerces.com.ayurjnanaapp E/AndroidRuntime: FATAL EXCEPTION: main
            Process: ayurjanaapp.dell.xerces.com.ayurjnanaapp, PID: 9298
            java.lang.OutOfMemoryError: Failed to allocate a 9437196 byte allocation with 3044192 free bytes and 2MB until OOM
                at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                at android.content.res.Resources.loadDrawableForCookie(Resources.java:2638)
                at android.content.res.Resources.loadDrawable(Resources.java:2543)
                at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
                at android.widget.ImageView.&lt;init&gt;(ImageView.java:162)
                at android.widget.ImageView.&lt;init&gt;(ImageView.java:150)
                at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:57)
                at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:53)
                at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
                at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
                at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
                at android.app.Dialog.setContentView(Dialog.java:512)
                at ayurjanaapp.dell.xerces.com.ayurjnanaapp.AnimationForSubsequentBellsActivity.showBellDialog(AnimationForSubsequentBellsActivity.java:41)
                at ayurjanaapp.dell.xerces.com.ayurjnanaapp.AnimationForSubsequentBellsActivity.onCreate(AnimationForSubsequentBellsActivity.java:31)
                at android.app.Activity.performCreate(Activity.java:6259)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
                at android.app.ActivityThread.access$900(ActivityThread.java:154)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:148)
                at android.app.ActivityThread.main(ActivityThread.java:5443)
                at java.lang.reflect.Method.invoke(Native Method)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    12-05 10:4
  </code></pre>