在某些设备中,我的应用程序有OutOfMemoryError
,其中包含以下堆栈跟踪:
java.lang.OutOfMemoryError: Failed to allocate a 16828428 byte allocation with 643016 free bytes and 627KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:2228)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:4211)
at android.content.res.Resources.loadDrawable(Resources.java:4085)
at android.content.res.Resources.getDrawable(Resources.java:2005)
at android.content.res.Resources.getDrawable(Resources.java:1987)
at android.content.Context.getDrawable(Context.java:464)
at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)
at android.support.v7.widget.TintManager.getDrawable(TintManager.java:175)
at android.support.v7.widget.TintManager.getDrawable(TintManager.java:168)
at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:51)
at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:72)
at com.coulddog.loopsbycdub.application.fragment.implementation.MediaPlayerFragment.updatePlayButtons(MediaPlayerFragment.java:299)
at com.coulddog.loopsbycdub.application.fragment.implementation.MediaPlayerFragment.setState(MediaPlayerFragment.java:288)
at com.coulddog.loopsbycdub.application.fragment.implementation.MediaPlayerFragment$8.onClick(MediaPlayerFragment.java:278)
at android.view.View.performClick(View.java:5697)
at android.view.View$PerformClick.run(View.java:22526)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
我不明白这个错误的原因。我的设备上没有发生此错误。所以,我有两个问题。首先,是否可以使我的真实设备或genymotion
模拟器对OutOfMemoryError
更敏感?第二个问题,这个错误的可能情况是什么?