gpt4 book ai didi

android - android google maps v2内存不足异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:32:51 25 4
gpt4 key购买 nike

当我在 map 上添加和删除标记时,一段时间后应用程序崩溃并显示内存不足异常消息。

logcat 响应是:

02-21 06:04:27.670: E/AndroidRuntime(1892): FATAL EXCEPTION: vts_com.rapidBizApps.mapamine
02-21 06:04:27.670: E/AndroidRuntime(1892): java.lang.OutOfMemoryError
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.bb.d.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.s.ap.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.r.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.e.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.e.a(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.o.handleMessage(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 06:04:27.670: E/AndroidRuntime(1892): at android.os.Looper.loop(Looper.java:130)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.e.j_(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.ak.ad.j_(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.bb.l.b(Unknown Source)
02-21 06:04:27.670: E/AndroidRuntime(1892): at maps.bb.l.run(Unknown Source)
02-21 06:04:33.260: D/dalvikvm(1892): GC_EXPLICIT freed 2148K, 53% free 5309K/11207K, external 21007K/21768K, paused 71ms

我的代码是:

loop 20 times:


mapView.addMarker(new MarkerOptions()
.position(new LatLng(latitude, longitude))
.icon(BitmapDescriptorFactory
.fromBitmap((bitmap)))
.snippet(text + " ")
.title(mine_name));

对于每个新循环,我都会删除 map 上的标记并添加新标记。

我也对位图给予了足够的关注

bitmap.recycle and assign bitmap with null after used bitmap/

最佳答案

此 google api 存在一些问题。我们必须等待下一个版本......BitmapDescriptorFactory 有内存泄漏。

http://code.google.com/p/gmaps-api-issues/issues/detail?id=4766&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal

13 年 1 月 25 日修复但未发布。快点谷歌!

关于android - android google maps v2内存不足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15017828/

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