Changes made to app are not being retained once run session ends - flutter

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.

Related

Upgrade Flutter debug build on device (using VSCode)

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.

Different app version when beginning debug versus restarting already running app

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.

Launching non-sandboxed Swift app at login -- best practice

I've developed a Mac status-menu app which can't be sandboxed, because it creates a virtual drive; it's installed alongside a Finder rightclick-menu extension, which does conform to sandboxing rules. At this point (after manual install) the right-click launches smoothly on login, but the application doesn't.
In recent versions of MacOS the previous methods for adding an app to login items (involving LSSharedFile) have been deprecated. The examples I've found since then involving SMLoginItemSetEnabled or launch agents (e.g. MenuApp in Swift 4 to Run on Login for High Sierra?) all seem to involve sandboxing. Is there a best practice for running an un-sandboxed app at login on OS X 10.11+ -- either in code or at installation time?
I'm thinking about using a launch agent, as described above; can all these steps be done at install time with administrator privileges, even without sandboxing? And if so, what would I need to do to automate uninstallation as well?

Freeze on Copying APK file

I created a new empty project, switched platform to Android and started Build and Run. But when it comes to "Copying APK File to device" it just freezes and I have to restart Unity.
I installed Android SDK & NDK tools just before that (through Unity Hub). Android Build Support was installed by me manually a while ago so it was visible as installed in Add Modules window. I did not do any changes to the project. The most interesting thing is that the apk is built in my Builds folder. Not sure if it works though.
I am using Unity 2019.1.0f2. The device Android version is 9.0 (API level 28) and the minimum API set in Player is 16, so the problem should not be with API.
Does anyone know possible reasons for it?
Try to turn off the following setting on your android device.
Settings -> Developer options -> Monitor apps installed by ADB
This setting(if turned on) will ask a verrification if you want to install the app. It feels like this cuts off the connection with unity which causes it to get stuck.
Unplugging and replugging the device seems to work aswell. In case of big projects this is anoying tho since if you are to quick it will just say it lost connection and it will ask if you want to reconnect, which in turn causes the same problem.
This is the only answer that worked for me:
https://answers.unity.com/questions/1248123/build-run-apk-freezes-on-pushing-content-only-one.html
In short, Player settings -> Publishing settings -> Split application binary
First of I would ask you on what computer did you run this on? (performance wise)
Second you can just copy the .apk file to the phone and install it there. If you got to where it prompts for copying to android your apk file is fine and built.

The app could not be located

i integrated crashlytics into my unity game, everything worked fine, but then i had to change my package name and my working mail, since then whenever i open the dashboard it gives me an alert "Sorry the app could not be located".
I reinstalled the crashlytics sdk in unity, used new login in prepare fabric tab, but the issue is still there, although the crashlytics seems to be working.
Thanks. Usually this means we aren't detecting the build and run event. Please make sure you are building and running in the relevant IDE. Also, clean your app and dependencies in the native IDE to make sure the bundle ID is updated in all locartions. If you still run into issues, you will need to contact support as your app may be in a weird state in our system.