I'm trying to load an image from url async (On a background thread).
Trying something like this:
val futureTarget = glide
.asBitmap()
.load("https://dummyimage.com/300/09f/fff.png")
.submit(300, 300)
val bitmap = futureTarget.get()
But it crashes the app when trying to load any image from URL, it works fine when loading local resources.
Logcat
There was 1 cause:
com.bumptech.glide.load.HttpException(Not Found)
call GlideException#logRootCauses(String) for more detail
at com.bumptech.glide.request.RequestFutureTarget.doGet(RequestFutureTarget.java:205)
at com.bumptech.glide.request.RequestFutureTarget.get(RequestFutureTarget.java:108)
at com.....Notifier$sendNotificationTest$1.run(Notifier.kt:85)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 cause:
com.bumptech.glide.load.HttpException(Not Found)
call GlideException#logRootCauses(String) for more detail
I have added Internet permissions.
<uses-permission android:name="android.permission.INTERNET" />
Providing Glide using Dagger 2
@Provides
@Singleton
static RequestManager provideGlide(final Application application) {
return GlideApp.with(application);
}
Any idea what I'm missing?
UPDATE
I figured out that there was an issue with some HttpInterceptors. This solution works downloading bitmaps synchronously.