SkAndroidCodec::NewFromStream 返回 null

SkAndroidCodec::NewFromStream returned null

提问人:Hilalkah 提问时间:4/18/2017 最后编辑:EricSchaeferHilalkah 更新时间:4/23/2021 访问量:2748

问:

我正在开发一个 Android 应用程序。我一直在 Android Monitor 上得到它,而 tileprovider 在地图上平铺 wms。

D/skia: --- SkAndroidCodec::NewFromStream returned null
D/skia: --- SkAndroidCodec::NewFromStream returned null
D/skia: --- SkAndroidCodec::NewFromStream returned null
D/skia: --- SkAndroidCodec::NewFromStream returned null

这是我的代码:

public class TileProviderFactory {
    // return a geoserver wms tile layer
    static TileProvider getTileProvider(final String url) {
        TileProvider tileProvider = new WMSTileProvider(256,256) {
        Bitmap image;
            @Override
            public synchronized URL getTileUrl(int x, int y, int zoom) {
               
                double[] bbox = getBoundingBox(x, y, zoom);
                String s;
                if (zoom > 15) {                    
                    s = url + "%26bbox%3D" + String.valueOf(bbox[MINX]) + "%2C"+ String.valueOf(bbox[MINY]) +
                              "%2C"+ String.valueOf(bbox[MAXX]) + "%2C"+ String.valueOf(bbox[MAXY]) ;

                } else {
                    s = "";
                }

                URL url = null;

                try {
                    url = new URL(s);

                    HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
                    // Fetch and set cookies in requests
                    CookieManager cookieManager = CookieManager.getInstance();
                    String cookie = cookieManager.getCookie(connection.getURL().toString());
                    if (cookie != null) {
                        connection.setRequestProperty("Cookie", cookie);
                    }
                    InputStream inputStream = connection.getInputStream();
                    image = BitmapFactory.decodeStream(inputStream);
                    inputStream.close();

                } catch (MalformedURLException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                    
                return url;

            }
        };

        return tileProvider;
    }
}

当我删除cookie时,没有任何变化。我认为 cookie 在 wms 平铺时不起作用。你有什么建议?我能做些什么?谢谢。

java android google-maps 磁贴 wms

评论


答: 暂无答案