1

有人可以帮我弄清楚我的应用程序出了什么问题:我在过去 3 天里试图弄清楚它是什么但没有运气也为什么不推荐使用画廊......我改用什么这就是为什么我的应用程序是强制的如果您需要我的 .java 代码,请关闭,让我知道,谢谢帮助 Logcat

06-05 16:50:33.234: D/skia(19241): --- allocation failed for scaled bitmap
06-05 16:50:33.234: D/AndroidRuntime(19241): Shutting down VM
06-05 16:50:33.241: W/dalvikvm(19241): threadid=1: thread exiting with uncaught     exception (group=0x40bdda08)
06-05 16:50:33.241: E/AndroidRuntime(19241): FATAL EXCEPTION: main
06-05 16:50:33.241: E/AndroidRuntime(19241): java.lang.OutOfMemoryError
06-05 16:50:33.241: E/AndroidRuntime(19241):    at     android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:786)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.content.res.Resources.loadDrawable(Resources.java:2013)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at     android.content.res.Resources.getDrawable(Resources.java:680)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.ImageView.resolveUri(ImageView.java:616)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.ImageView.setImageResource(ImageView.java:349)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.istyleevents.ImageAdapter.getView(ImageAdapter.java:45)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at   android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at  android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer.doFrame(Choreographer.java:532)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Handler.handleCallback(Handler.java:725)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Handler.dispatchMessage(Handler.java:92)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Looper.loop(Looper.java:137)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.app.ActivityThread.main(ActivityThread.java:5229)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at java.lang.reflect.Method.invokeNative(Native Method)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at java.lang.reflect.Method.invoke(Method.java:525)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at dalvik.system.NativeStart.main(Native Method)
06-05 16:50:35.585: I/Process(19241): Sending signal. PID: 19241 SIG: 9
4

2 回答 2

0

OutOfMemoryError. 您的应用程序正在填充设备的内存。也许这正在发生:

  • 您的应用出于某种原因故意在内存中分配大量数据(图像),而不控制设备可用的内存量。
  • 您的应用程序不会取消分配不再使用的先前分配的数据(打开图像并且在关闭图像时不释放内存)。
  • 一些其他类型的内存泄漏。

您应该阅读有关内存泄漏的信息。这里有一些信息:http ://android-developers.blogspot.com.es/2009/01/avoiding-memory-leaks.html

另外,可能图像太大了。您必须在加载之前调整它的大小。

于 2013-06-05T16:11:47.177 回答
0

如果在模拟器上进行测试,请尝试通过从 AVD 管理器中编辑来增加 AVD 的 VM 堆大小。

于 2013-06-05T16:20:23.847 回答