OutOfMemoryError 问题 - Android
issue in OutOfMemoryError - Android
我遇到以下错误。我试过 android:largeHeap="true"
和 android:hardwareAccelerated="false"
。但 app
仍然崩溃并显示相同的错误
java.lang.OutOfMemoryError: Failed to allocate a 39306252 byte allocation with 16777216 free bytes and 27MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
如果您的 BitMap 尺寸很大,那么您必须 resize/rescale 它才能在您的应用程序中显示它,否则会抛出 OutOfMemory 错误,您可以尝试使用
android:largeHeap="true"
在你的清单中,或者你必须在你的代码中手动调整它们的大小,看看
How to Resize a Bitmap in Android?
我遇到以下错误。我试过 android:largeHeap="true"
和 android:hardwareAccelerated="false"
。但 app
仍然崩溃并显示相同的错误
java.lang.OutOfMemoryError: Failed to allocate a 39306252 byte allocation with 16777216 free bytes and 27MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
如果您的 BitMap 尺寸很大,那么您必须 resize/rescale 它才能在您的应用程序中显示它,否则会抛出 OutOfMemory 错误,您可以尝试使用
android:largeHeap="true"
在你的清单中,或者你必须在你的代码中手动调整它们的大小,看看 How to Resize a Bitmap in Android?