gpt4 book ai didi

具有 10 个标记的 Android 基本 API v2 MapActivity outOfMemory

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:16:46 26 4
gpt4 key购买 nike

我正在尝试使用带有 Android 支持库的 Android Maps API v2 来实现 map ,在带有 Android 2.2 的 Droid2 上进行测试一切都运行良好,但只是持续了很短的一段时间。一旦我添加 10 个标记并尝试移动 map 或放大/缩小,每秒都会抛出以下错误,导致可怕的异常和崩溃。我在后台什么都不做。实际上只有 map 和 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)

布局:

<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"));
}

最佳答案

标记图像有多少尺寸?尝试将标记图像调整得更小

关于具有 10 个标记的 Android 基本 API v2 MapActivity outOfMemory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14189095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com