Serge Veiler
Serge Veiler

Reputation: 13

Libgdx + Glide - Couldn't load dependencies of asset

Unlike all the issues involving this error, this one is a bit tricky.

I have the following:

Downloading a .png image with Glide v3 into my app's internal storage, using SimpleTarget to get a bitmap and saving it into a file. I know by fact that this sometimes is saving a corrupted file, maybe due timeout issues.

This is ok.

The problem comes when libgdx's AssetManager tries to render this file.

It throws the "Couldn't load dependencies of asset" error.

Which is ok.

So, what I need to know is:

Is there any way to catch that error getting the file name to delete it and start a new download call?

What I tried to do already:

Thank you guys in advance.

Upvotes: 0

Views: 483

Answers (1)

nEx.Software
nEx.Software

Reputation: 6862

You can add an AssetErrorListener to your AssetManager. This will give you the AssetDescriptor for the particular asset which failed to load as well as the associated exception. Those two pieces of information should allow you to get what you need to redownload and retry.

Upvotes: 2

Related Questions