您好我一直在尝试在Eclipse中开发一个简单的游戏我在尝试添加背景图像的阶段但是当我尝试运行应用程序时,我得到了#34;不幸的是已停止工作&#34 34;看着日志猫,我最好的猜测是下面的位图工厂生产线出了问题:
background = new Background(BitmapFactory.decodeResource(getResources(), R.drawable.underwater), ScreenWidth, this);
以下是我收到的Log Cat:
FATAL EXCEPTION: main
java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:376)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:406)
at com.example.deepseadiver.GamePanel.<init>(GamePanel.java:21)
at com.example.deepseadiver.Game.onCreate(Game.java:69)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2139)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2210)
at android.app.ActivityThread.access$600(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1208)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4931)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
at dalvik.system.NativeStart.main(Native Method)
非常感谢任何有关如何解决此问题的帮助或建议。
答案 0 :(得分:0)
在应用程序标记集大堆中更新清单文件 -
.
.
<application
android:largeHeap="true"
. .
>
....
</application>