gpt4 book ai didi

android - Google map V2 的致命异常 : GLThread, StackOverflowError

转载 作者:搜寻专家 更新时间:2023-11-01 08:05:04 25 4
gpt4 key购买 nike

我正在实现 Google Maps V2,并在其上绘制从外部 GPX 文件、设备路径、设备当前位置和交付点位置接收的交付路线。问题是它大部分时间都有效......接下来是我得到的错误(当它不工作时):

    03-16 20:48:37.811: I/dalvikvm(16510): threadid=30: stack overflow on call to Lmaps/t/bx;.d:FLLL
03-16 20:48:37.811: I/dalvikvm(16510): method requires 40+20+0=60 bytes, fp is 0x60223318 (24 left)
03-16 20:48:37.811: I/dalvikvm(16510): expanding stack end (0x60223300 to 0x60223000)
03-16 20:48:37.811: I/dalvikvm(16510): Shrank stack (to 0x60223300, curFrame is 0x60226e54)
03-16 20:48:37.821: D/gralloc(16510): unmap_buffer: Successfully unmapped 0xa5000 bytes at address 0x60416000, SharedFd=89, map_count = 3
03-16 20:48:37.821: D/gralloc(16510): unmap_buffer: Successfully unmapped 0xa5000 bytes at address 0x604bb000, SharedFd=96, map_count = 2
03-16 20:48:37.881: W/dalvikvm(16510): threadid=30: thread exiting with uncaught exception (group=0x409f61f8)

03-16 20:32:23.471: E/AndroidRuntime(16283): FATAL EXCEPTION: GLThread 1827
03-16 20:32:23.471: E/AndroidRuntime(16283): java.lang.StackOverflowError
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.bx.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.bx.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)
03-16 20:32:23.471: E/AndroidRuntime(16283): at maps.t.cg.a(Unknown Source)

下面是产生问题的代码示例。

UpdateMap 方法只在Activity 的onCreate 方法中被调用一次。 UpdateMap 内部是 DrawUserLocationOnMap 调用。我愿意接受任何建议。

更新映射方法:

private void UpdateMap() {
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
int i = 0;

// GPS COORDINATES RECEIVED FROM GPX FILE
PolylineOptions pOptions = new PolylineOptions();
LatLng initialCameraPosition = null;

for (GpxTrackModel trackModel : ProviderUtility.GpxProvider.GpxTracks) {
for (GpxTrackCoordinateModel coorModel : trackModel.getTrackCoordinates()) {
if (i == 0)
initialCameraPosition = new LatLng(coorModel.getLatitude(), coorModel.getLongitude());

pOptions.add(new LatLng(coorModel.getLatitude(), coorModel.getLongitude()));
i++;
}

// ADDING DESTINATION MARKERS (LAST LOCATION IN TRACK SEGMENT)
MarkerOptions mOptions = new MarkerOptions();
mOptions.draggable(false);

GpxTrackCoordinateModel model = trackModel.getTrackCoordinates().get(trackModel.getTrackCoordinates().size() - 1);
mOptions.position(new LatLng(model.getLatitude(), model.getLongitude()));
mOptions.title(trackModel.getName());

map.addMarker(mOptions).showInfoWindow();
map.animateCamera(CameraUpdateFactory.newLatLngZoom(initialCameraPosition, 14));


DrawUserLocationOnMap();

}
pOptions.color(Color.parseColor("#FF0000"));
map.addPolyline(pOptions);

}

DrawUserLocationOnMap 方法:

PolylineOptions recordedPOptions = null;
MarkerOptions userLocation = null;

private void DrawUserLocationOnMap() {

// RECORDED GPS DATA WITH GREEN LINE
if (recordedPOptions == null)
recordedPOptions = new PolylineOptions();

// ADDING SAVED USER GPS COORDINATES FROM DATABASE AND DRAWING PATH
ArrayList<GPSTrackingModel> list = ProviderUtility.GPSTrackingProvider.GetGPSCoordinates(false);
for (GPSTrackingModel recordedGps : list)
recordedPOptions.add(new LatLng(Double.parseDouble(recordedGps.getLatitude()), Double.parseDouble(recordedGps.getLongitude())));

recordedPOptions.color(Color.parseColor("#00FF00"));
map.addPolyline(recordedPOptions);



// ADDING CURRENT LOCATION MARKER
GPSTrackingModel lastPosition = ProviderUtility.GPSTrackingProvider.GetLastCoordinate();
if (lastPosition != null && lastPosition.getLatitude() != null
&& !lastPosition.getLatitude().equals("")
&& lastPosition.getLongitude() != null
&& !lastPosition.getLongitude().equals("")) {

LatLng lp = new LatLng(Double.parseDouble(lastPosition.getLatitude()), Double.parseDouble(lastPosition.getLongitude()));

if (userLocation == null) {
userLocation = new MarkerOptions();

userLocation.draggable(false);

userLocation.position(lp);
userLocation.title("My current location");
userLocation.icon(BitmapDescriptorFactory.fromResource(R.drawable.currentlocation));
map.addMarker(userLocation);
} else
userLocation.position(lp);

float zoom = map.getCameraPosition().zoom;
if (zoom < 14)
zoom = 14;
map.animateCamera(CameraUpdateFactory.newLatLngZoom(lp, zoom));
}
}

更新:

为了强制错误,我添加了每 200 毫秒调用一次 DrawUserLocationOnMap() 方法的循环。 4-5 秒后它崩溃了。

最佳答案

我将从解决您的代码的一些问题开始,并希望其中之一是导致 Maps V2 库出错的原因。

  1. 不要在循环内多次调用 animateCamera()。您的用户会感到头晕。请最后调用一次。

  2. 不要一直在相同的位置重新添加相同的标记,因为您的代码是通过调用它几十次(“每 200 毫秒。4-5 秒后它崩溃”)来完成的可能是相同的模型数据,因为它要么是无效的生产代码(如果您确实这样做),要么是无效的测试(如果这纯粹是您强制崩溃的人为产物)。

如果这些方法没有帮助,请慢慢开始注释掉部分代码,直到您可以精确地缩小触发无限递归的范围。我希望堆栈跟踪可以具体显示在您的代码中触发问题的位置,但这没有成功。

关于android - Google map V2 的致命异常 : GLThread, StackOverflowError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15453542/

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