-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashes on re-launching after some time in background in release builds, but doesnt in debug (java.lang.ClassCastException: android.view.View$BaseSavedState cannot be cast to b.a.b.a.i$d) #47635
Comments
I have the same issue. Are you sure it has to do with out of memory? I have not digged too deep in the problem yet and thought it had to do with my pageview where i keep the state alive on page change |
@ercadev I verified that it was due to OOM by going through logcat and finding that crash occurred only when the system killed the app in background. You can also try and verify this. The system does log which app is being killed |
But is that expected? That app gets killed if for example you have to many apps open? Have you solved the provlem yet? |
Its expected for the app to get killed in oom conditions. And since flutter doesn't provide the same native state restoration as native platforms , you expect the app to start from scratch after getting killed. But in this case its crashing. Open App > Killed by OOM > Crashed when opening from recents/Multi tasking > Opens fine now
Nope. Maybe its some proguard/r8 like issue caused due to minification in release builds but I don't have the skill to debug this |
Okay I understand. I don't have the skill either. Hope someone with knowledge can answer. I'm going to try some things and will come back to you if I find something. My Error from Crashlytics:
|
So my problem seems to been gone now. I don't get these crashes anymore and the only thing i did was to follow the step "Enabling Proguard" here |
I have proguard configured but am also experiencing those crashes :-/ |
I followed exactly these steps to enable proguard (admittedly the first time I've set it up). |
@kazume can't say much without see what you did exactly. Share the repo if you can |
|
@kazume you seem to be missing a proguard rules file. Also you seem to be using a lot of plugins that might need extra proguard rules maybe |
puh ok, thx for the review ... I'll look into that :) |
Thx again for the hint. I created the proguard-rules file but it was at the wrong location :) now the crash is history for me as well. |
Flutter docs now recommend using R8 alone , and all references of proguard have been removed. But the crash still occurs in release when proguard isnt used. |
Is there any solution for latest stable version of flutter? I did not enabled proguard or disabled R8. |
@themisir for now you will need to enable proguard on release builds. You can see the commit i referenced this issue for reference |
This issue help me a lot. |
I still see this issue using Stable Channel - v1.12.13+hotfix.5. Hint: To easily test/reproduce - allow only 1 background process on your android device (via developer options), so when you switch between apps, it needs to recreate from scratch. Fix: Enable proguard on your release builds. I used these instructions: |
This happens for me as well, couldn't fix it yet. |
I have the same issue when clearing ram and resume the app. |
@matthew-carroll thanks that would be great! Easiest way to reproduce seems to be this:
If you instead build the app with Edit: Updated with ADB command to simulate OOM kill. |
I can confirm that @pascalw's steps reproduce the issue on my side. I can privately share access to the project that has this exact issue @matthew-carroll. |
Thanks @pascalw and @orestesgaolin With @pascalw's reproduction steps I have repro'd the crash. I'm investigating now.
|
I added a It would be great if someone who is comfortable with local engine compilation could give that PR a try to verify what I found locally. |
@matthew-carroll thanks for the fix! I tried compiling the engine locally but my computer doesn't have enough resources 🙈 Now that your PR is merged, is there a way to verify it via the master channel? |
The only option to verify it is still to compile the engine locally. You'll need to wait for an engine roll into the framework to be able to verify this on the |
Closing since we believe this got fixed with flutter/engine#16916. Please re-open if this is not correct. |
…oreground after being evicted from memory. (flutter#47635) (flutter/engine#16916)
…oreground after being evicted from memory. (flutter#47635) (flutter/engine#16916)
Will the engine update be effective on Flutter Stable branch too? |
This fix is on master and in the dev channel at versions |
Thanks! I can confirm it's fixed if I build my APK using master 👍 |
@tvolkert when can we expect next stable release ? Because I do face that issue on my new app, which is already has crashes on Android 9.0. |
@canewsin we're working to push this to beta next week (in the next few days). The next stable is 4-6 weeks away. |
@matthew-carroll instead of switching to master or dev repo of flutter, can we put a proguard rule in our project, to keep class ? Could you give me the proguard rule ! |
Currently I was using --no-shrink option hope it will solve the error. |
@canewsin Here is the old documentation how to enable proguard. Works perfectly for me. |
@ercadev I know how to use proguard, but my issue is, I use many libraries, so if I forgot to add any rule to it, which is required by library, then it will break another part of app. So, instead I opt for --no-shrink option. |
I released my app today, which was built on the stable build, but few users are getting this issue. Don't know what the cause of the problem is, it's a very specific and small subset of users facing this problem, but it has caused users to rate the app with 1 star :( What can I do to build the app without this error? |
@blasten we're on R8 now, right? Do you know if there is a rule that devs can add to solve this problem locally until the next stable Flutter release? |
While waiting for the next stable release, it's possible to add a proguard rule. Check this article. In
|
Any news regarding this point ? I have exactly same situation with the last verstion:
I will setup proguard waiting for stable. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
Target Platform: Android
Target OS version/browser: Running on Android 10
Logs
ADB Logs
Expected result: The app to start from scratch as it was killed by the system and i am not saving native state
Actual result: The app tries to open and then crashes within a second . It works fine on subsequent launches until this issue occurs again.
This only occurs on release builds and not debug builds . Debug builds give the expected result
Attached: Link to the release apk https://github.com/kriticalflare/SIES-Library/blob/master/demo/app-release.apk
flutter doctor -v
The text was updated successfully, but these errors were encountered: