0

I recently upgraded the Glide package to 4.12.0 and I get the following error in one of my activities:

Fatal Exception: java.lang.IllegalArgumentException
You cannot start a load for a destroyed activity

com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed (RequestManagerRetriever.java:13)

From what I read it could be from the way I call glide.with() so I updated it according to what I saw (in this link) like this:

Glide.with( this )

However, it still crashes.

It crashes inside a firestore .addOnCompleteListener. Like this:

db.collection( "Items" ).whereEqualTo( "visibility", true ).orderBy( "dateCreated", Query.Direction.DESCENDING ).limit( AppConstants.QUERY_SIZE ).get()
        .addOnCompleteListener( task -> {
            if (task.isSuccessful()) {

                ItemAdapter = new ItemsAdapter( Glide.with( this ) );
                ItemAdapter.notifyDataSetChanged();
                rv_Items.setAdapter( ItemAdapter );

            }
        } );

Should it be something else than this in this case?

Thank you

Ben
  • 1,737
  • 2
  • 30
  • 61

1 Answers1

0

I think I have the same issue. by reading your request I suppose that the problem is with "this" because it refers to the listener and not to the activity.so you should put MainActivity.this instead if your code is inside MainActivity hope this helps

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30443848) – Thira Nov 28 '21 at 08:39