SkAndroidCodec::NewFromStream returned null
Asked Answered
T

0

28

I'm developing an Android App. I'm getting that on Android Monitor all the time while tileprovider tiling wms on map.

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

And here's my code:

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;
    }
}

When I remove cookie nothing has changed. I think cookies not working on when wms tiling. What do you recommend? What Can I do? Thanks.

Triage answered 18/4, 2017 at 11:31 Comment(4)
had you solve it? @TriageVibrator
@KaWingTamTkw It works when you remove the cookie on the service side. Otherwise I could not find a solution to the problem.Triage
Why are you using an https stream, you need to handle a certificate, and use Hostname verifier and SslsocketFactory and set GET or POST, perhaps various others also.Topfull
You probably do not have the skia library installed. What may be a worry is, are you using a Quad core, and you do have skia reputably installed, and using jdk 17Topfull

© 2022 - 2024 — McMap. All rights reserved.