为什么我的应用程序在使用特定图像时会崩溃?

时间:2012-10-13 17:11:41

标签: android imageview android-imageview logcat android-logcat

我有一个可行的代码,在布局中使用ImageView。在重新启动Eclipse之前,应用程序可以成功运行。之后,每当我使用特定图像时,我的应用程序都会崩溃。我尝试用另一个图像替换图像,它可以成功运行。导致我的应用崩溃的图片尺寸为608 x 2964,它是一个PNG文件。

有人能告诉我什么是错的吗?我真的不明白LogCat中写的是什么,因为我是Android的新手。如果有人可以帮助我,请欣赏它。感谢。

以下是我的LogCat的链接:http://pastie.org/pastes/5053152/text?key=zg7tbpuj9zqvlje4v6aczq

这是我的ImageView。

<ImageView
android:contentDescription="@string/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"     
android:layout_marginBottom="10dp" 
android:adjustViewBounds="true"
android:src="@drawable/about_mj" 
android:layout_gravity="center_horizontal"/>

4 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

从日志中可以清楚地看到您的图像很大并导致

java.lang.OutOfMemoryError: bitmap size exceeds VM budget

优化您的形象。

答案 2 :(得分:0)

看起来以下错误是问题

java.lang.OutOfMemoryError: bitmap size exceeds VM budget

看看以下帖子。它有多种可能的解决方案来解决这个问题: java.lang.OutOfMemoryError: bitmap size exceeds VM budget - Android

答案 3 :(得分:0)

是的,它显示了OutOMemoryError,它在第44行的XML(布局)文件中显示了inflateException。我认为您在布局中使用了一些可能无法正确分配值的drawable。