私はGoogleMapsV2を実装しており、外部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メソッドで1回だけ呼び出されます。UpdateMapの内部には、DrawUserLocationOnMap呼び出しがあります。私はどんな提案に対しても開かれています。
UpdateMapメソッド:
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秒後にクラッシュしました。