Can I enable logging for `AsyncImage` in coil-comp...
# compose
l
Can I enable logging for
AsyncImage
in coil-compose?
j
what are you trying to do? you can hook it into the httpd resolver if you wanted to log everything
what are you trying to do? you can hook it into the httpd resolver if you wanted to log everything
l
I wanted to see why it doesn't load the images on the Android emulator.
It only loads them when I add the following line to AndroidManifest:
Copy code
android:usesCleartextTraffic="true"
z
You sure you're loading https links? No reason not to have it
l
Yes, sure.

https://image.tmdb.org/t/p/w780/sjx6zjQI2dLGtEL0HGWsnq6UyLU.jpg

y
It doesn't look like it, but there is always a chance that OkHttpClient is handling redirects. You could add an event listener to see exactly what is going on. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-event-listener/
And also set
Copy code
OkHttpClient.Builder().followSslRedirects(false).build()
FWIW in my coil usage with 3rd party controlled images, I've had to set an interceptor to force SSL as some content specifies http URLs.
l
From Coil's author's response it looks like the Android emulator's security provider might be at fault here: https://github.com/coil-kt/coil/issues/1126#issuecomment-1030726847
Update: it's actually the fact that Android emulator seems to not synchronize date and time with the network. After setting the time/date manually to the current one, images started working. Also cold booting the emulator might help (looks like booting from a saved image for some reason sets the date/time to the one from when the image was saved).
BTW logging in Coil can be easily enabled by setting a custom singleton
ImageLoader
with an
HttpLoggingInterceptor
in your
Application
class: https://coil-kt.github.io/coil/getting_started/#singleton