我曾经在 mipmap 文件夹中有我的应用程序的图像,但我没有不同的分辨率(我在所有 5 个文件夹中都有完全相同的图像)。为了节省空间,我将这些图像移到了 drawable 文件夹中(除了作为唯一具有不同分辨率的图像的启动器图标)。但是当我打开一个包含其中一些图像的活动时,我收到以下崩溃错误:
java.lang.OutOfMemoryError: Failed to allocate a
29304012 byte allocation with 16777216 free bytes and
23MB until OOM
at
dalvik.system.VMRuntime.newNonMovableArray(Native
Method)
at
android.graphics.BitmapFactory.nativeDecodeAsset(Native
Method)
at
android.graphics.BitmapFactory.decodeStream(BitmapFac
tory.java:624)
at
android.graphics.BitmapFactory.decodeResourceStream(Bi
tmapFactory.java:457)
at
android.graphics.drawable.Drawable.createFromResource
Stream(Drawable.java:1152)
at
android.content.res.ResourcesImpl.createFromResourceSt
ream(ResourcesImpl.java:1272)
at
android.content.res.ResourcesImpl.loadDrawableForCooki
e(ResourcesImpl.java:743)
at
android.content.res.ResourcesImpl.loadDrawable(Resourc
esImpl.java:585)
at
android.content.res.MiuiResourcesImpl.loadDrawable(Miui
ResourcesImpl.java:308)
at
android.content.res.Resources.loadDrawable(Resources.ja va:872)
at
android.content.res.TypedArray.getDrawable(TypedArray.ja
va:930)
at android.view.View.<init>(View.java:4182)
at android.widget.TextView.<init>(TextView.java:710)
at android.widget.Button.<init>(Button.java:109)
at android.widget.Button.<init>(Button.java:105)
at android.support.v7.widget.AppCompatButton.<init>.
(AppCompatButton.java:70)
at android.support.v7.widget.AppCompatButton.<init>.
(AppCompatButton.java:66)
at
android.support.v7.app.AppCompatViewInflater.createButt
on(AppCompatViewInflater.java:186)
at
android.support.v7.app.AppCompatViewInflater.createVie
w(AppCompatViewInflater.java:109)
at
android.support.v7.app.AppCompatDelegateImplV9.create
View(AppCompatDelegateImplV9.java:1035)
at
android.support.v7.app.AppCompatDelegateImplV9.onCre
ateView(AppCompatDelegateImplV9.java:1092)
at
android.view.LayoutInflater.createViewFromTag(LayoutInfl
ater.java:794)
at
红糖糍粑
蝴蝶不菲
UYOU
相关分类