我正在開發一個使用谷歌地圖的應用程序。它可以在除特定設備之外的所有設備上正常運行:Google Nexus S - 我們只能訪問一臺此類設備。 錯誤是,在導航地圖時,應用程序崩潰與OutOfMemoryError。 下面是堆棧跟蹤:安卓谷歌地圖在Nexus S上崩潰
04-18 14:17:52.601 E/AndroidRuntime(2714): FATAL EXCEPTION: main
04-18 14:17:52.601 E/AndroidRuntime(2714): java.lang.OutOfMemoryError
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.graphics.Bitmap.nativeCreate(Native Method)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.graphics.Bitmap.createBitmap(Bitmap.java:585)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.google.android.maps.ZoomHelper.createSnapshot(ZoomHelper.java:444)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.google.android.maps.ZoomHelper.beginZoom(ZoomHelper.java:194)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.google.android.maps.MapView$2.onScaleBegin(MapView.java:380)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ScaleGestureDetector.onTouchEvent(ScaleGestureDetector.java:261)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.google.android.maps.MapView.onTouchEvent(MapView.java:682)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.View.dispatchTouchEvent(View.java:5486)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1953)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1714)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1959)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1728)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1892)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1840)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.View.dispatchPointerEvent(View.java:5662)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2863)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.os.Handler.dispatchMessage(Handler.java:99)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.os.Looper.loop(Looper.java:137)
04-18 14:17:52.601 E/AndroidRuntime(2714): at android.app.ActivityThread.main(ActivityThread.java:4340)
04-18 14:17:52.601 E/AndroidRuntime(2714): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 14:17:52.601 E/AndroidRuntime(2714): at java.lang.reflect.Method.invoke(Method.java:511)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-18 14:17:52.601 E/AndroidRuntime(2714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-18 14:17:52.601 E/AndroidRuntime(2714): at dalvik.system.NativeStart.main(Native Method)
任何人都可以證實,如果他們碰到了同樣的問題?如果是這樣,你碰巧有這個解決方案嗎?
我正在使用和加載位圖...其中一些確實很大,但它們沒有加載到地圖活動中。您是否碰巧有任何資源/鏈接可以更有效地進行位圖加載而不會丟失質量? – gunar 2012-04-19 06:01:14