Sto cercando di implementare la mappa utilizzando Android Maps API v2 con libreria di supporto Android, test su Droid2 con Android 2.2 Tutto funziona bene, ma solo per un breve periodo di tempo. Una volta che aggiungo 10 marcatori e provo a spostare la mappa o lo zoom in/out, i seguenti errori vengono lanciati ogni secondo risultanti in un'eccezione temuta e il crash segue. Non sto facendo nulla sullo sfondo. C'è letteralmente solo la mappa e 10 indicatori.API di base Android v2 MapActivity outOfMemory con 10 marcatori
Grazie per eventuali suggerimenti.
Martin
Errori:
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
Eccezione:
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)
Disposizione:
<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"
/>
Marcatori:
for (int i = 0; i < 9; i++) {
mMap.addMarker(new MarkerOptions()
.position(new LatLng(49d, 16d))
.draggable(true)
.title("BUUUUU")
.snippet("TEST"));
}
Potrebbe essere perché si aggiungono 10 marcatori solo in una singola posizione. Basta provare ad aggiungere il marcatore su diverse posizioni. – GrIsHu
questo è solo un testcase, si comporta allo stesso modo quando i marcatori sono in posti diversi (sarebbe stato un errore banale di google se non lo fosse) – martenson
Sto correndo lo stesso problema anche su quel dispositivo. Concesso che posso disegnare 50 marcatori, ma dopo 10 pentole della mappa muore. Stavo guardando l'heap e non ha mai utilizzato l'intero heap. Avevo ancora 5mb ma è morto quando ha richiesto lo stesso importo della tua app. Sto leggendo quel 1048576-byte sbagliato? :( – Steven