I noticed when I first begin debugging a flutter app I'm developing I will get an old version of the app that I previously loaded. When I then restart the app without closing it out I will have the correct version.
Is there a cache that is not being cleared prior to when I begin debugging? Flutter clean works but I have to perform this manually every time. Possibly a setting in visual studio.
Related
I recently installed Flutter on my Chromebook (4 GB RAM). I have been writing snippets of dart code using vscode with no issues. Recently, I decided to move into the flutter framework, and then when I try to run the default application generated after creating a new project, VS Code freezes after a while. I know initially this was supposed to take a while to load being my first time, but is over 1 hour the appropriate time?
I have tried restarting VS Code several times, but still the same output. I even switched to using Android Studio, and this even crashes after a while.
What could be wrong or what am I getting wrong? I followed the official installation process on both VS Code and Flutter.dev sites.
i will assume that you have set up your emulator correctly and you opened the emulator with these steps:
1- on your keyboard use ctrl + shift + p and choose Flutter: Select Device and wait for the emulator to open.
2- after the emulator starts, from the upper menu of VSCode select Run > Run without debugging.
the app should run, if the problem persists, in VSCode open a new terminal window and type :
1- flutter upgrade
2- flutter clean
3- flutter pub get
try to run the application hopefully it will run
I am using flutter version 1.22.6, I have already published my application and have to make minor changes in my application that is why I do not wish to upgrade flutter sdk in my application. But when I try to build my application it says:
Xcode build failed due to concurrent builds
It pops up till some time and then it displays the error:
unable to attach DB: error: accessing build database
database is locked Possibly there are two concurrent builds running in the same filesystem location.
I have tried the solutions such as closing the Xcode and building only from my VS Code editor, also tried flutter clean and then build. Can someone help me with this if I do not have to upgrade flutter?
Don't do anything, just wait another minute or two and then it works (for me, at least).
I have an app that is just for personal use. I can run it from VSCode directly (just run & debug). It saves its data onto its assigned "disk space" on the device. However, when I close the app and restart it (no longer connected to my dev PC), it starts up an old version of the app - obviously the one I last really installed on the device.
The only way I know to have the latest version on the device would be to deinstall it, then install it via devPC. Unfortunately, this deletes the local files of the app.
Is there a way to upgrade the installed version directly from the dev PC? I think it is possible to manually install the newest apk after I built it, but is there a way as easy as "run & debug", with the only difference that the latest version of the app starts when I restart the app?
There are no option to upgrade the app locally from PC. Every time you connect the phone and press Run & Debug, it will rebuild the app again.
In order to persist your data through different app versions, you should consider integrating some simple backend structure to your app.
You can think of creating a database which will provide you data every time you open the app. One easy option you can try is to integrate the Cloud Firestore in your app. You can follow this tutorial here to understand the implementation and feel free to ask if you need any further support.
When I run updated code of my application, it first builds the previous version of my app and then on rebuilding it, it runs the updated version of my app. Where the problem located? And as well, I'm a new bie at flutter...
Look of app on first run
Look of app after re-running
[]
How can I always get the updated code version of app on first run?
Run Flutter clean command in the terminal.
Actually we must remove/clean the cache of previous App so for that sake, We can run Flutter clean command in the terminal to avoid this problem.
Let's say I'm connected to an actual device, making multiple changes to my app and hot-reload/restart is doing its thing and life's all good. Once I'm satisfied with changes I hit the stop button.
Now, if I pick up the phone and launch the app - it will be an older version of the app that doesn't contain the changes just implemented.
In order to get most recent changes I have to uninstall app from the phone and then go back into the IDE (VSC) and run the app once more to get the latest changes.
Is there a configuration setting that allows you to avoid having to do this?
It is my understanding that while you are developing, and hot-reloading/restarting, you are working on the Dart Virtual Machine. So if you don't make a full build and install the APK on your device then once you close the development build you are working on the VM closes and the code that was running on it is lost.
To answer your question, there is no configuration that you can set to have what is running on the VM to be on the APK without a full build.