Flutter app not working after reopening from recent apps

Viewed 527

I am working on a flutter application and I am stuck on following error.
When I close the flutter application without removing it from recent apps and reopen it from recent apps I get this type of error:

D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed
D/MALI    ( 3778): gles_state_set_error_internal:75: [MALI] GLES ctx: 0x88f80008, error code:0x505
D/MALI    ( 3778): gles_state_set_error_internal:76: [MALI] GLES error info: execution failed

And the current screen in the app freezes. The app doesn't work unless I rebuilt (flutter clean and the build) and reinstall it. I tried searching online for solution but found nothing! Result of `flutter doctor`:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18362.1016], locale en-IN)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.48.1)
[√] Connected device (1 available)

• No issues found!

Thanks in advance.

4 Answers

For the answer I assume that you are simulating on Android device, not pre iOS 12 simulators. Also, the code of the screen that causes the error would help

From the error log we can see that the cause is the graphics rendering API. Also, the trigger of the error is the press of recent apps button on Android device

Given above stated parameters, my first assumption is that your app is trying to render something upon the onPause() callback of the Activity Lifecycle. So, you probably need to check how you override lifecycle methods in your code.

My second guess, is that you may be doing some asynchronous processes which are not well handled/recycled in the runtime. So, probably you need to properly initiate/run/dispose any asynchronous methods you might have. In that case, erroneously handled asynchronous tasks may interfere with graphics processes and lead to memory leaks

This issue is very recent ,here are the github threads on it .

issue 1 issue 2

I can confirm It has nothing to do with the code nor the phone ,because even the very basic flutter app that comes after flutter create also does the same on different phones,so this is because of the latest flutter release .Other older flutter apps on the phones I tried don't make this behavior.

I Downloaded the latest stable flutter release that doesn't have this problem ,version 1.17.5

You can get it from here

I have this issue too.my flutter version is 1.20.how resolve?

@BolatTleubayev, while I agree with you, see my earlier comments, I have tried to debug the setState

  @override
  void initState() {
  super.initState();
  getItems();
} 

  getItems() async {
//filterFree = await storage.read(key: Str.FILTER_FREE);
initClearVisibility();
initFilters();
setState(() {
  loadingItems = true;
  Visibility(visible: true, child: CircularProgressIndicator());
});

QuerySnapshot querySnapshot = await query.get();
items = querySnapshot.docs;
lastDocument = querySnapshot.docs[querySnapshot.docs.length - 1];
setState(() {
  loadingItems = false;
  Visibility(visible: false, child: CircularProgressIndicator());
});
}

 initClearVisibility() {
if (Str.filterSelectCategory != Str.CATEGORY) {
  clearCategoryVisible = true;
  allCategoriesVisible = false;
  categoryValue = Str.filterSelectCategory;
  //   items.clear();
  // getItems();
  setState(() {});
}
}

initFilters() async {   
filterDefaultItems();
}

  filterDefaultItems() async {
query = _firestore
    .collection(Str.ITEMS)
    .where(Str.IS_ITEM_SOLD, isEqualTo: false) 
    .where(Str.ADDRESS, isEqualTo: userAddress1)
    //.orderBy(Str.DATE_POSTED)
    .limit(perPage);
}

The error: setState called after dispose is on this getItems(); I am not sure if the error is caused by this or the update as this error was not in the previous flutter version. Currently on 1.20.2

Related