loadRemoteImage()

Hi,

I am getting no image when I use loadRemoteImage() on an Android device. Works fine on the simulator though… I didnt have the params parameter initially but put in in later, same results. Any suggestions ?

Thx

Sanjit

local params = {}

    params.headers = {}

    params.headers[“Content-Type”] = “image/png”

    params.headers[“User-Agent”] = “Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0”

    params.headers[“Accept-Language”]= “en-US,en;q=0.5”

    params.headers[“Accept-Encoding”] = “gzip, deflate”

    display.loadRemoteImage(“https://graph.facebook.com/620112803/picture”, “GET”,  

        function(event)

            local root = root

             if ( event.isError ) then

                print(“Remote image error”)

            else

                print(“Remote image ok”)

                print(“RIMGG::”, event.target.contentWidth, event.target.contentHeight)

                local pic = event.target

                --pic.alpha = 0

                --transition.to( pic, { alpha = 1 } )

                

                fitImage(pic, ww, hh)

                pic.x = xx

                pic.y = yy

                sceneGroup:insert(pic)

                pic:toFront()

            end

        end, 

        params,

        filename,

        system.TemporaryDirectory,

        xx,yy

    )

11-10 23:20:57.734: E/Corona(6738): ERROR: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: W/System.err(6738): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: E/Corona(6738): ERROR: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:545)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:509)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)

11-10 23:20:57.734: W/System.err(6738): at java.io.InputStream.read(InputStream.java:162)

11-10 23:20:57.734: W/System.err(6738): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)

11-10 23:20:57.734: W/System.err(6738): at java.io.BufferedInputStream.read(BufferedInputStream.java:227)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.Util.readAsciiLine(Util.java:316)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)

11-10 23:20:57.734: W/System.err(6738): at network.NetworkRequest$AsyncNetworkRequestRunnable.run(NetworkRequest.java:1394)

11-10 23:20:57.734: W/System.err(6738): at java.lang.Thread.run(Thread.java:841)

11-10 23:20:57.734: W/System.err(6738): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.Posix.recvfromBytes(Native Method)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.Posix.recvfrom(Posix.java:141)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)

11-10 23:20:57.734: W/System.err(6738): … 15 more

11-10 23:20:57.734: W/System.err(6738): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:545)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:509)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)

11-10 23:20:57.734: W/System.err(6738): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)

11-10 23:20:57.734: W/System.err(6738): at java.io.InputStream.read(InputStream.java:162)

11-10 23:20:57.734: W/System.err(6738): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)

11-10 23:20:57.734: W/System.err(6738): at java.io.BufferedInputStream.read(BufferedInputStream.java:227)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.Util.readAsciiLine(Util.java:316)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)

11-10 23:20:57.734: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)

11-10 23:20:57.734: W/System.err(6738): at network.NetworkRequest$AsyncNetworkRequestRunnable.run(NetworkRequest.java:1394)

11-10 23:20:57.734: W/System.err(6738): at java.lang.Thread.run(Thread.java:841)

11-10 23:20:57.734: W/System.err(6738): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.Posix.recvfromBytes(Native Method)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.Posix.recvfrom(Posix.java:141)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)

11-10 23:20:57.734: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)

11-10 23:20:57.734: W/System.err(6738): … 15 more

11-10 23:20:57.774: E/Corona(6738): ERROR: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.774: W/System.err(6738): java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.774: W/System.err(6738): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:545)

11-10 23:20:57.774: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:509)

11-10 23:20:57.774: W/System.err(6738): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)

11-10 23:20:57.774: W/System.err(6738): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)

11-10 23:20:57.774: W/System.err(6738): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)

11-10 23:20:57.774: W/System.err(6738): at java.io.InputStream.read(InputStream.java:162)

11-10 23:20:57.774: W/System.err(6738): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)

11-10 23:20:57.774: W/System.err(6738): at java.io.BufferedInputStream.read(BufferedInputStream.java:227)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.Util.readAsciiLine(Util.java:316)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)

11-10 23:20:57.774: W/System.err(6738): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)

11-10 23:20:57.774: W/System.err(6738): at network.NetworkRequest$AsyncNetworkRequestRunnable.run(NetworkRequest.java:1394)

11-10 23:20:57.784: W/System.err(6738): at java.lang.Thread.run(Thread.java:841)

11-10 23:20:57.784: W/System.err(6738): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)

11-10 23:20:57.784: W/System.err(6738): at libcore.io.Posix.recvfromBytes(Native Method)

11-10 23:20:57.784: W/System.err(6738): at libcore.io.Posix.recvfrom(Posix.java:141)

11-10 23:20:57.784: W/System.err(6738): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)

11-10 23:20:57.784: W/System.err(6738): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)

11-10 23:20:57.784: W/System.err(6738): … 15 more

Just noticed that it all works fine for “display.loadRemoteImage(“http://upload.wikimedia.org/wikipedia/commons/6/6a/Tricoloring.png”, “GET” …” .

And fails for  display.loadRemoteImage(“https://graph.facebook.com/620112803/picture”, “GET”,…  .

So is it a https vs http problem ???

And when it fails there are no network errors (event.isError is false) and the image has zero dimensions…

Sanjit

If that’s all the log then it looks like your event handler isn’t getting called at all.  Can you confirm all your variables like “filename”?  What is the “root” variable?

Now one thing I noticed is that the first URL (the one you want to use) has a redirect going on.  The URL I ended up isn’t the same as the one you entered.

My event handler is being called but the image is of zero size. Maybe indirection is causing it to fail. But it works in the simulator and all variables are correct !
The root is the group I wanted to add it to but for testing am adding it to sceneGroup or self.view.

Also this is an extract of the complete log.

The log didn’t make it.

Hi Rob

The network errors in the previous log were not from Corona… so please ignore… no idea where they came from.

Here is what I did now: I used the FB SDK to retrieve the actual URL of the user’s picture. This is an absolute url and not a redirect. I then fed it to my code. Again all works well in the Simulator but on the device the call seems to succeed but the image is of size zero.

***************************************************************

local ww = h*0.85

  local hh = w

    local xx = margin*2 + button_size + ww/2 +padding/2

    local yy = y; 

    local filename = “download” … tostring(math.random()) … “.jpg”

url = “[https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211&__gda__=1424394365_30c2dab39230109502f30c76c53cfb6d”](https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211& gda =1424394365_30c2dab39230109502f30c76c53cfb6d)

                display.loadRemoteImage(url, “GET”,  

                    function(event)

                         if ( event.isError ) then

                            print(“Remote image error”)

                        else

                            print(“Remote image ok”)

                            print(“RIMGG::”, event.target.contentWidth, event.target.contentHeight)

                            local pic = event.target

                            --pic.alpha = 0

                            --transition.to( pic, { alpha = 1 } )

                            

                            fitImage(pic, ww, hh)

                            pic.x = xx

                            pic.y = yy

                            sceneGroup:insert(pic)

                            pic:toFront()

                        end

                    end, 

                    params,

                    filename,

                    system.TemporaryDirectory,

                    xx,yy

                )

***************************************************************

Now there are NO log entries indicating some network error. Just my two entries that say

“Remote image ok”  

and

RIMGG:: 0 0 

On the simulator it is 

RIMGG:: 50 50

The only thing I can suspect is the “https” url. All “http” based urls work on simulator and device.

Or is it an Android specific thing where the temp file is not writable to the TemporaryDirectory ?

Am I missing something ??

Thx

Sanjit

Here is another test I did. Basically I wrote a simplified file downloader and displayed the image. I also use the lfs to look at the System.DocumentsDirectory to see if the file is indeed downloaded and is of the right size and the log output says it is. But the display.newImage just doesnt work !

Here is the simplified function:

*************************************************************************************************************************************

function test_net(root)

    local function networkListener( event )

        print("NET RESPONSE = ", json.encode(event, {indent=true}))

        if ( event.isError ) then

            print( “NETWORK:: Network error - download failed” )

        elseif ( event.phase == “began” ) then

            print( “NETWORK:: Progress Phase: began” )

        elseif ( event.phase == “ended” ) then

            --local filename = system.pathForFile(event.response.filename, system.DocumentsDirectory,0,0 )

            local filename = event.response.filename

            print( “NETWORK:: Displaying response image file = " , filename, " basedir=”, event.response.baseDirectory)

            --myImage = display.newImage( filename, event.response.baseDirectory, 60, 40 )

            --myImage = display.newImage(filename, system.DocumentsDirectory, 50,50 )

            myImage = display.newImage(“helloCopy2.txt” , system.DocumentsDirectory)

            print(myImage.contentWidth)

            --myImage.alpha = 0

            --transition.to( myImage, { alpha=1.0 } )

            root:insert(myImage)

            myImage:toFront()

            local doc_path = system.pathForFile( “”, system.DocumentsDirectory )

            local k=1;

            for file in lfs.dir(doc_path) do

               --file is the current file or directory name

               local attr = lfs.attributes(system.pathForFile(file, system.DocumentsDirectory ))

               print(k, "Found file: " … file, " ", json.encode(attr) )

               k = k + 1

            end

        end

    end

    local params = {}

    headers = {

            [“User-Agent”] = “Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0”,

            [“Content-Type”] = “image/jpg”,

            [“accept”] = “*/*”,

            [“accept-charset”] = “*”,

            [“Accept-Language”]= “en-US,en;q=0.5”,

            [“Accept-Encoding”] = “gzip, deflate”,

        }

    params.progress = true

    

    params.headers = headers

    

    network.download(

        – THE FIRST URL WORKS ALWAYS BUT THE SECOND DOES NOT WORK ON THE DEVICE !!

        --"http://docs.coronalabs.com/images/simulator/image-mask-base2.png", 

        “[https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211&__gda__=1424394365_30c2dab39230109502f30c76c53cfb6d”,](https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211& gda =1424394365_30c2dab39230109502f30c76c53cfb6d)

        “GET”,

        networkListener,

        params,

        “helloCopy2.txt”,

        system.DocumentsDirectory

    )

end 

******************************************************************************************************************************************************

And here is the dump

11-11 15:40:58.114: I/Corona(13803): NET RESPONSE = {

11-11 15:40:58.114: I/Corona(13803):   “responseHeaders”:{

11-11 15:40:58.114: I/Corona(13803):     “Access-Control-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Content-Length”:“1384”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Response-Source”:“NETWORK 200”,

11-11 15:40:58.114: I/Corona(13803):     “Date”:“Tue, 11 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Sent-Millis”:“1415700657608”,

11-11 15:40:58.114: I/Corona(13803):     “Timing-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Expires”:“Tue, 25 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Selected-Transport”:“http/1.1”,

11-11 15:40:58.114: I/Corona(13803):     “Cache-Control”:“no-transform, max-age=1209600”,

11-11 15:40:58.114: I/Corona(13803):     “Last-Modified”:“Tue, 25 Feb 2014 19:34:28 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Received-Millis”:“1415700658111”,

11-11 15:40:58.114: I/Corona(13803):     “Content-Type”:“image/jpeg”,

11-11 15:40:58.114: I/Corona(13803):     “HTTP-STATUS-LINE”:“HTTP/1.1 200 OK”,

11-11 15:40:58.114: I/Corona(13803):     “Connection”:“keep-alive”

11-11 15:40:58.114: I/Corona(13803):   },

11-11 15:40:58.114: I/Corona(13803):   “phase”:“began”,

11-11 15:40:58.114: I/Corona(13803):   “bytesEstimated”:1384,

11-11 15:40:58.114: I/Corona(13803):   “name”:“networkRequest”,

11-11 15:40:58.114: I/Corona(13803):   “bytesTransferred”:0,

11-11 15:40:58.114: I/Corona(13803):   “status”:200,

11-11 15:40:58.114: I/Corona(13803):   “url”:"[https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211&__gda__=1424394365_30c2dab39230109502f30c76c53cfb6d",](https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211& gda =1424394365_30c2dab39230109502f30c76c53cfb6d)

11-11 15:40:58.114: I/Corona(13803):   “isError”:false,

11-11 15:40:58.114: I/Corona(13803):   “requestId”:"<type ‘userdata’ is not supported by JSON.>"

11-11 15:40:58.114: I/Corona(13803): }

11-11 15:40:58.114: I/Corona(13803): NETWORK:: Progress Phase: began

11-11 15:40:58.114: I/Corona(13803): NET RESPONSE = {

11-11 15:40:58.114: I/Corona(13803):   “responseHeaders”:{

11-11 15:40:58.114: I/Corona(13803):     “Access-Control-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Content-Length”:“1384”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Response-Source”:“NETWORK 200”,

11-11 15:40:58.114: I/Corona(13803):     “Date”:“Tue, 11 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Sent-Millis”:“1415700657608”,

11-11 15:40:58.114: I/Corona(13803):     “Timing-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Expires”:“Tue, 25 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Selected-Transport”:“http/1.1”,

11-11 15:40:58.114: I/Corona(13803):     “Cache-Control”:“no-transform, max-age=1209600”,

11-11 15:40:58.114: I/Corona(13803):     “Last-Modified”:“Tue, 25 Feb 2014 19:34:28 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Received-Millis”:“1415700658111”,

11-11 15:40:58.114: I/Corona(13803):     “Content-Type”:“image/jpeg”,

11-11 15:40:58.114: I/Corona(13803):     “HTTP-STATUS-LINE”:“HTTP/1.1 200 OK”,

11-11 15:40:58.114: I/Corona(13803):     “Connection”:“keep-alive”

11-11 15:40:58.114: I/Corona(13803):   },

11-11 15:40:58.114: I/Corona(13803):   “phase”:“progress”,

11-11 15:40:58.114: I/Corona(13803):   “bytesEstimated”:1384,

11-11 15:40:58.114: I/Corona(13803):   “name”:“networkRequest”,

11-11 15:40:58.114: I/Corona(13803):   “bytesTransferred”:1024,

11-11 15:40:58.114: I/Corona(13803):   “status”:200,

11-11 15:40:58.114: I/Corona(13803):   “url”:"[https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211&__gda__=1424394365_30c2dab39230109502f30c76c53cfb6d",](https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211& gda =1424394365_30c2dab39230109502f30c76c53cfb6d)

11-11 15:40:58.114: I/Corona(13803):   “isError”:false,

11-11 15:40:58.114: I/Corona(13803):   “requestId”:"<type ‘userdata’ is not supported by JSON.>"

11-11 15:40:58.114: I/Corona(13803): }

11-11 15:40:58.114: I/Corona(13803): NET RESPONSE = {

11-11 15:40:58.114: I/Corona(13803):   “responseHeaders”:{

11-11 15:40:58.114: I/Corona(13803):     “Access-Control-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Content-Length”:“1384”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Response-Source”:“NETWORK 200”,

11-11 15:40:58.114: I/Corona(13803):     “Date”:“Tue, 11 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Sent-Millis”:“1415700657608”,

11-11 15:40:58.114: I/Corona(13803):     “Timing-Allow-Origin”:"*",

11-11 15:40:58.114: I/Corona(13803):     “Expires”:“Tue, 25 Nov 2014 10:10:59 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Selected-Transport”:“http/1.1”,

11-11 15:40:58.114: I/Corona(13803):     “Cache-Control”:“no-transform, max-age=1209600”,

11-11 15:40:58.114: I/Corona(13803):     “Last-Modified”:“Tue, 25 Feb 2014 19:34:28 GMT”,

11-11 15:40:58.114: I/Corona(13803):     “X-Android-Received-Millis”:“1415700658111”,

11-11 15:40:58.114: I/Corona(13803):     “Content-Type”:“image/jpeg”,

11-11 15:40:58.114: I/Corona(13803):     “HTTP-STATUS-LINE”:“HTTP/1.1 200 OK”,

11-11 15:40:58.114: I/Corona(13803):     “Connection”:“keep-alive”

11-11 15:40:58.114: I/Corona(13803):   },

11-11 15:40:58.114: I/Corona(13803):   “responseType”:“binary”,

11-11 15:40:58.114: I/Corona(13803):   “phase”:“ended”,

11-11 15:40:58.114: I/Corona(13803):   “bytesEstimated”:1384,

11-11 15:40:58.114: I/Corona(13803):   “response”:{

11-11 15:40:58.114: I/Corona(13803):     “fullPath”:"/data/data/com.sanjit.signtist/app_data/helloCopy2.txt",

11-11 15:40:58.114: I/Corona(13803):     “filename”:“helloCopy2.txt”,

11-11 15:40:58.114: I/Corona(13803):     “baseDirectory”:"<type ‘userdata’ is not supported by JSON.>"

11-11 15:40:58.114: I/Corona(13803):   },

11-11 15:40:58.114: I/Corona(13803):   “name”:“networkRequest”,

11-11 15:40:58.114: I/Corona(13803):   “bytesTransferred”:1384,

11-11 15:40:58.114: I/Corona(13803):   “status”:200,

11-11 15:40:58.114: I/Corona(13803):   “url”:"[https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211&__gda__=1424394365_30c2dab39230109502f30c76c53cfb6d",](https://m.ak.fbcdn.net/profile.ak/hprofile-ak-xpf1/v/t1.0-1/c0.13.50.50/p50x50/1898067_10152047616577804_876002957_n.jpg?oh=577b4f540607eb16aaf9e37e6227b0f3&oe=54EFD211& gda =1424394365_30c2dab39230109502f30c76c53cfb6d)

11-11 15:40:58.114: I/Corona(13803):   “isError”:false,

11-11 15:40:58.114: I/Corona(13803):   “requestId”:"<type ‘userdata’ is not supported by JSON.>"

11-11 15:40:58.114: I/Corona(13803): }

11-11 15:40:58.114: I/Corona(13803): NETWORK:: Displaying response image file = helloCopy2.txt basedir= userdata: 0x79729b71

11-11 15:40:58.124: I/Corona(13803): 0

11-11 15:40:58.124: I/Corona(13803): 1 Found file: . {“dev”:45852,“change”:1415700658,“access”:1415443286,“rdev”:0,“nlink”:2,“blksize”:4096,“permissions”:“rwxrwx–x”,“uid”:10213,“blocks”:8,“gid”:10213,“ino”:203833,“mode”:“directory”,“modification”:1415700658,“size”:4096}

11-11 15:40:58.124: I/Corona(13803): 2 Found file: … {“dev”:45852,“change”:1415700590,“access”:1415443275,“rdev”:0,“nlink”:7,“blksize”:4096,“permissions”:“rwxr-x–x”,“uid”:10213,“blocks”:8,“gid”:10213,“ino”:203790,“mode”:“directory”,“modification”:1415700590,“size”:4096}

11-11 15:40:58.124: I/Corona(13803): 3 Found file: helloCopy2.txt {“dev”:45852,“change”:1415700658,“access”:1415700658,“rdev”:0,“nlink”:1,“blksize”:4096,“permissions”:“rw-------”,“uid”:10213,“blocks”:8,“gid”:10213,“ino”:203604,“mode”:“file”,“modification”:1415700658,“size”:1384}

***********************************************************************

As you can see the print(myImage.contentWidth) printed 0. But the file is CLEARLY there in the directory (1384 bytes which is the correct size) !!

Please help !

Sanjit

Is this also because it’s a trial version ?

Is there a reason you’re naming it .txt instead of .jpg?

This shouldn’t be a “trial” issue.  If it’s not working, it’s not working.

Yes I renamed to txt trying desparately to find out what’s wrong. Its just not working.

Does it work if you build the app using Corona SDK?

What version of Corona Cards for Android are you using/

Well, it works in the simulator from the SDK. I am using the latest trial version. How do I check the corona cards version ?

You could always use the system.getInfo() API call.  I think there is a way to get the build # from it.

Rob

Here is the system info on my Nexus 5

11-15 04:26:18.941: I/Corona(22291): ############################################################

11-15 04:26:18.941: I/Corona(22291): SYS INFO - build = 2014.2407

11-15 04:26:18.941: I/Corona(22291): SYS INFO - architectureInfo = ARM Neon

11-15 04:26:18.941: I/Corona(22291): SYS INFO - environment = device

11-15 04:26:18.941: I/Corona(22291): SYS INFO - model = Nexus 5

11-15 04:26:18.941: I/Corona(22291): SYS INFO - platformName = Android

11-15 04:26:18.941: I/Corona(22291): SYS INFO - platformVersion = 4.4.4

11-15 04:26:18.941: I/Corona(22291): SYS INFO - version = 3.0.0

11-15 04:26:18.941: I/Corona(22291): SYS INFO - maxTextureSize = 4096

11-15 04:26:18.941: I/Corona(22291): ############################################################

And this is when I run it in the Simulator

############################################################

SYS INFO - build =      2014.2393

SYS INFO - architectureInfo =   x64

SYS INFO - environment =        simulator

SYS INFO - model =      iPhone

SYS INFO - platformName =       Win

SYS INFO - platformVersion =    6.2

SYS INFO - version =    3.0.0

SYS INFO - maxTextureSize =     16384

############################################################

Can I get you to put together a minimal project that will generate this issue and put it in a .zip file along with the build.settings and config.lua that goes along with it and any necessary assets and use the “Report a bug” link at the top of the page.  Make sure to refer to this forum thread in the text of the message.

Thanks

Rob

Also have you added:
 

 <uses-permission android:name=“android.permission.INTERNET”/>

To the AndroidManifest.xml file within the <manifest> block?

Also keep in mind. CoronaCards is native development.  It does not use build.settings at all.  Anything you need from build.settings needs to happen in the project file (including supported plugin libraries, anything in the android = {} table, orientation items, etc.

If you do iOS stuff, the things in iphone = { plist = {} } } needs added to the Info.plist manually.

Rob

Yes I have the android settings done correctly as I do Facebook logins etc in native code.

So does this mean I need to wait for the next release where this issue might be resolved ? Is there a quick fix or some other solution ?

Sanjit

Did you file a bug report?  They will need your whole project.

Rob