Open davehorner opened 1 year ago
After factoring out the problem to a reproduction; going back to my application. I changed the AppManifest to use android:label="@string/app_name" which is different depending on release/debug. The main application is now working in both debug and release.
The sample is still failing and a valid reproduction case. I don't know if the label changing is the thing that unstuck the application... it is troublesome debugging when things just start working. Luckily we have a reproduction and I can continue my development without being stuck!
Let me know if you have any suggestions on how to help corral this issue.
My application is not working anymore. There's something strange going on.
I don't have any error in release mode. I was correctly able to open the settings page and change the theme
Maybe try flutter clean
/ flutter pub uprade
and try again
clean and upgrades done many times. I'm glad and also sorry to hear it works. not a fun problem.
Both the sample and the application exhibit the release exception here.
I'm running Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3324], locale en-US) I am using multidex in the application, the sample does not so it may not relate.
I have no other ideas other than to try it on another machine; which is what you've done.
Do you see anything wrong with the code? It's happening in debug this evening.
Nope, I see nothing wrong with the sample you gave so far
I have an app that works fine in debug mode. When run in release the application can not find the provider from the context. I can see that the MultiProvider is working as I see the constructor printing output in both release and debug. I see from many other reports that others have experienced the same problem of debug builds succeeding and release builds failing but I see no one has created a reproduction.
To reproduce, I pulled apart my code and tried to get the basics of what I'm doing in a new flutter project. https://github.com/davehorner/provider-release-debug-reproduction This works in debug and grey screen exception in release.
The sample tries to create a themeprovider which is used to create and theme the materialApp. Then when the user clicks the "s" button, it tries to get the provider from the context using Consumer. I did not connect the provider to display or actually set the themes in the sample. Debug does allow you to change the theme from the settings page and it shows properly on MyHomePage when settings is pop'd. Release will not construct settings page and gives a grey screen exception.
Hopefully this gives you an idea of what I'm doing wrong. I didn't spend too much time on the sample, it isn't functional, but if you run in debug, you'll find the Consumer gets the provider, running in release, it will fail.
I am running this on android. I tried going back to 5.0.0, error persists. Running out of ideas.