当我第一次运行我的动态壁纸时,一切正常。但在那之后,现场壁纸预览会说"不幸的是......已经停止了。但是几秒后它会再次起作用。我注意到,当它给我那个错误屏幕时,它出现在我的logcat中:
Process: live.wallpaper.dav3.spacelivewallpaper, PID: 2748
java.lang.OutOfMemoryError: Failed to allocate a 16777228 byte allocation with 3319256 free bytes and 3MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:726)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:547)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:575)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:605)
at com.dav3.java.Background.<init>(Background.java:66)
at com.dav3.java.MainService$WallpaperEngine.onCreate(MainService.java:47)
at android.service.wallpaper.WallpaperService$Engine.attach(WallpaperService.java:895)
at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1166)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5972)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
它告诉我(我认为)我已经超过了我的位图的咬合限制。任何人都可以告诉我一种方法来解决这个问题,我的位图文件是否很大?壁纸再次正常工作但它在设置之前和之后总是有崩溃的文本,所以它会变得非常烦人,但几秒钟后它就会开始工作。我将不胜感激,谢谢! =)