Search code examples
javaandroidkotlinpicasso

Error HTTP 504 When load image form URL with picasso android library


I want to load image from URL with picasso android library and show it to view but I get an error only in android 7.0 Nougat.

The URL of the image uses HTTPS. In my other project with the same image URL I didn't get the error if I run in real device 7.0 nougat, but it still error if I run in emulator 7.0 Nougat.

I try to other URL image from different domain and I didn't get the error too.

how do I fix it?

Picasso.get().load("My_URL_Image")
                .resize(200,200)
                .centerInside()
                .placeholder(R.drawable.ic_default)
                .error(R.drawable.ic_default)
                .into(holder.imageView, object : Callback{
                    override fun onSuccess() {}

                    override fun onError(e: Exception?) {
                        e?.printStackTrace()
                    }

                })
W/System.err: com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 504
W/System.err:     at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
W/System.err:     at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
W/System.err:     at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
        at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)

Solution

  • Thanks for help me guys, I found my solution for this case, I delete FirebaseFirestore.getInstance() on my home activity because I no longer use firebase at home page. I'm not sure why but if I not delete that code in my home page, application running normal in real device android 7.0 Nougat but still error in emulator 7.0 Nougat.