2013-01-07 1 views
7

안드로이드 2.2에서 Droid2로 테스트하여 안드로이드 Maps API v2를 사용하여 맵을 구현하려고합니다. 모든 것이 잘 작동하지만 잠시 동안 만 작동합니다. 10 개의 마커를 추가하고지도를 이동하거나 확대/축소하려고하면 매 초마다 다음과 같은 오류가 발생하여 두려운 예외가 발생하고 충돌이 발생합니다. 배경에서 아무 것도하지 않습니다. 문자 그대로지도와 10 개의 마커가 있습니다.Android 기본 API v2 MapActivity outOfMemory (마커 10 개 포함)

주셔서 감사합니다.

마틴

오류 :

01-07 03:03:23.221: DEBUG/dalvikvm(12914): GC_FOR_MALLOC freed 38714 objects/1797752 bytes in 74ms 
01-07 03:03:23.378: ERROR/dalvikvm-heap(12914): 1048576-byte external allocation too large for this process. 
01-07 03:03:23.378: ERROR/GraphicsJNI(12914): VM won't let us allocate 1048576 bytes 
01-07 03:03:23.378: WARN/System.err(12914): OutOfMemory 
01-07 03:03:23.432: DEBUG/dalvikvm(12914): GC_EXPLICIT freed 8793 objects/601896 bytes in 58ms 
01-07 03:03:23.862: ERROR/dalvikvm-heap(12914): 1048576-byte external allocation too large for this process. 
01-07 03:03:23.862: ERROR/GraphicsJNI(12914): VM won't let us allocate 1048576 bytes 
01-07 03:03:23.870: WARN/System.err(12914): OutOfMemory 

예외 :

01-07 02:45:12.432: ERROR/dalvikvm-heap(12315): 1048576-byte external allocation too  large for this process. 
01-07 02:45:12.432: ERROR/GraphicsJNI(12315): VM won't let us allocate 1048576 bytes 
01-07 02:45:12.464: WARN/dalvikvm(12315): threadid=17: thread exiting with uncaught exception (group=0x400208b0) 
01-07 02:45:12.479: ERROR/AndroidRuntime(12315): FATAL EXCEPTION: GLThread 18 
    java.lang.OutOfMemoryError: bitmap size exceeds VM budget 
    at android.graphics.Bitmap.nativeCreate(Native Method) 
    at android.graphics.Bitmap.createBitmap(Bitmap.java:498) 
    at maps.r.h.a(Unknown Source) 
    at maps.cp.a.a(Unknown Source) 
    at maps.cp.a.a(Unknown Source) 
    at maps.cp.a.b(Unknown Source) 
    at maps.m.n.a(Unknown Source) 
    at maps.m.at.a(Unknown Source) 
    at maps.a.bq.a(Unknown Source) 
    at maps.a.w.a(Unknown Source) 
    at maps.a.w.a(Unknown Source) 
    at maps.a.w.a(Unknown Source) 
    at maps.a.ba.m(Unknown Source) 
    at maps.a.ba.run(Unknown Source) 

레이아웃 :

,451,515,
<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:map="http://schemas.android.com/apk/res-auto" 
     class="com.google.android.gms.maps.SupportMapFragment" 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     map:cameraTargetLat="49.85" 
     map:cameraTargetLng="15.42" 
     map:mapType="normal" 
     map:uiCompass="true" 
     map:uiRotateGestures="true" 
     map:uiScrollGestures="true" 
     map:uiTiltGestures="true" 
     map:uiZoomControls="false" 
     map:uiZoomGestures="true" 
    /> 

마커 : 마커 이미지의

for (int i = 0; i < 9; i++) { 

    mMap.addMarker(new MarkerOptions() 
      .position(new LatLng(49d, 16d)) 
      .draggable(true) 
      .title("BUUUUU") 
      .snippet("TEST")); 
    } 
+0

단일 위치에서만 10 개의 마커를 추가 할 수도 있습니다. 마커를 다른 위치에 추가하십시오. – GrIsHu

+1

thats 그냥 테스트 케이스, 마커가 다른 장소에있는 경우 동일한 행동 (didnt 경우 사소한 구글 실수했을) – martenson

+1

나는 그 장치 에서뿐만 아니라 동일한 문제를 실행하고 있습니다. 50 개의 마커를 뽑을 수는 있지만 맵의 10 개의 팬이 지나면 마커가 사라집니다. 나는 힙을보고 있었고 결코 힙을 모두 사용하지 않았습니다. 나는 여전히 5MB를 가졌지 만 앱과 같은 양을 요구할 때 죽었다. 그 1048576 바이트를 잘못 읽고 있니? : ( – Steven

답변

0

얼마나 많은 크기? 마커 이미지의 크기를 더 작게하려고 시도하십시오.

+1

기본 마커입니다. 변경하지 않았습니다. – martenson

관련 문제