1

我正在尝试SKCoordinates在. 表演时SKMapSurfaceviewSKPolylineSKSurfaceView.addPolyline( SKPolyline )

我从 libc 收到致命信号 6 SIGABRT。

MapActivity.java

public class MapActivity extends BaseRouteActivity 
{

    ...

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        SKMapSurfaceView mapView = SKMapViewHolder mapHolder = (SKMapViewHolder)
                    findViewById(map_target);
        mapView = mapHolder.getMapSurfaceView();
        mapView.setMapSurfaceListener(this);

        List<SKCoordinate> coordinates = new ArrayList<SKCoordinate>();
        coordinates.add( new SKCoordinate( 52.390846319385254, 4.643051476057394 ) );
        coordinates.add( new SKCoordinate( 52.391088576419605, 4.643212408598288 ) );

        SKPolyline polyline = new SKPolyline();
        polyline.setNodes(coordinates);

        mapView.addPolyline(polyline);   
    }

    ...
}

Logcat 错误

8009-8009/com.my.app A/libc﹕ Fatal signal 6 (SIGABRT) at 0x00001f49 (code=-6), thread 8009 (y.app)

addPolyline自从我读到Android会杀死UI阻塞功能中的所有网络流量后,我就尝试将其包装起来UIThread/AsyncTask,但无济于事。

我错过了什么?

编辑#1:在 LogCat 中进行更多挖掘后,我收到此错误:

JNI WARNING: GetFloatArrayElements received null array
in Lcom/skobbler/ngx/map/MapRenderer;.addobjectpolyline:([D[D[F[FIIII)I (GetFloatArrayElements)
4

1 回答 1

2

这是一个 SDK 问题,将在下一个版本中修复。当未指定用于样式化 SKPolyline 对象的 color 和 outlineColor 属性时,会发生崩溃。为避免崩溃,您应该为折线指定样式属性,如下面的代码所示:

List<SKCoordinate> coordinates = new ArrayList<SKCoordinate>(); 
coordinates.add( new SKCoordinate( 52.390846319385254, 4.643051476057394 ) ); 
coordinates.add( new SKCoordinate( 52.391088576419605, 4.643212408598288 ) ); 

SKPolyline polyline = new SKPolyline(); 
polyline.setNodes(coordinates); 

// set styling properties (crash will occur if color or outlineColor are not specified) 
polyline.setLineSize(9); 
polyline.setOutlineSize(4); 
polyline.setColor(new float[] {0, 0, 0, 1}); 
polyline.setOutlineColor(new float[] {0, 0, 0, 1}); 
polyline.setOutlineDottedPixelsSolid(6); 
polyline.setOutlineDottedPixelsSkip(0); 

mapView.addPolyline(polyline);
于 2014-08-07T15:03:35.273 回答