Okay, so in my app I have multiple ImageViews each holding an .png icon. right now there are 7... And yet my app, at random intervals, will crash with a anr dialog (App Not Responding) and it then throws this exception:
10-08 00:14:15.528 32732-32732/com.antechdevelopment.NotificationReminders E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.antechdevelopment.NotificationReminders, PID: 32732
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
at android.content.res.Resources.loadDrawable(Resources.java:3024)
at android.content.res.Resources.getDrawable(Resources.java:1586)
at android.app.ApplicationPackageManager.getDefaultActivityIcon(ApplicationPackageManager.java:783)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3466)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1879)
at android.view.Window.findViewById(Window.java:924)
at android.app.Activity.findViewById(Activity.java:1965)
at android.app.Activity1ドル.findViewById(Activity.java:745)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:880)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.BackStackRecord.run(BackStackRecord.java:684)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
at android.app.Activity.performStart(Activity.java:5435)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
at android.app.ActivityThread.access900ドル(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Does anyone have an idea? I'm pretty stumped and annoyed! Thanks!
-
post code of error line numberakash yadav– akash yadav2014年10月08日 05:35:20 +00:00Commented Oct 8, 2014 at 5:35
1 Answer 1
Just as the error states, you're running out of memory. This is most likely due to the size of the image and how its being loaded. A lot of libs have been created to solve these issues.
Try using some image loading libraries like one of the ones below. Most likely you'll be able to solve your issue using one of these battle tested libs.