Flutter: How to backup flutter project without build directory? - flutter

I want to make a complete backup of the Flutter project, and I noticed the build folder is the biggest one.
Size Details:
Total App Size: 889.6 MB
Build Directory: 743 MB
Remaining directories, including ios, android, assets and lib: 146 MB
I think, zipping project excluding build directory would be considered full backup and it will contain everything needed to start again.
Q. Is that correct? (if I'm wrong then is there any way to reduce app size?)

Delete build folder.
Delete Pod folder from IOS Directory
.gradle folder from android Directory
& if you have release & build folder in Android then delete it
Run Command: Fluter Clean
Now Folder will be 1MB to 10MB, depending on assets folder size.

To start with i would suggest git versioning with an online (public or private) repository as a good way to back up your code. To answer your Question, There's absolutely no problem with leaving out the build folder, Actually almost by default git will ignore the build folder. Note that every time you compile the app, that build folder is refreshed, actually its always good to start by cleaning it

In IntelliJ idea base ides (like Android Studio), you can get a lightweight .zip backup from your code.
Just follow this path in the top menu:
File> Export> Project to Zip File

Related

Flutter failed to delete a directory at "build\flutter_assets"

I've never had this error. The error doesn't appear when I run "flutter run -d chrome" for the initial flutter example but when I add a couple of folders this error appears. thank you for the help
Flutter failed to delete a directory at "build\flutter_assets". The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
The build folder is auto-generated when flutter runs. If you created the flutter_assets folder in the build folder, move it to the assets folder instead. (I mixed up the assets and flutter_assets folders in my head.)
I had this issue and wound up manually deleting the entire build folder and running flutter clean (see other suggestions here on SO and here on GitHub).

my flutter project creates folders build 1, build 2, build 3 etc

It does not affect anything but size of project - hence git push takes forever.
I already tried deleting it once but it appears again once flutter run and continues where it stopped making new folders with every fresh run or so.
I am using MacOS
Let me know if you need more information!
Appreciate any help!
So apparently my mac optimized the storage and deleted some (unused) parts of the project which triggered flutter to make the new folders. In the end I needed to compress the whole project to be able to move it on the internal disk (somewhere on user) and then deleted all extra folders with the initial folders. I then ran the command flutter create . to create all folders. After a flutter clean it was running without any problems or creating extra folders.
Lesson learned: never create a flutter project within iCloud Drive folders.

Node.js app: "Disk quota exceeded" when installing npm module with lots of files

When adding https://www.npmjs.com/package/material-design-icons as a dependency to my Node application, cf push fails with Disk quota exceeded when running npm install. Since the complete application including node_modules has about 100 MB (way below the limit of 1 GB), I assume it might have to do with the fact that material-design-icons has about 86'000 files (for whatever reason).
Is there any workaround for this?
Another solution is to ignore the node_modules directory using the .cfignore file (the same concept as the .gitignore file). The files described in the .cfignore aren't uploaded to Cloud Foundry when you push your app.
You can find more about .cfignore here: https://docs.developer.swisscom.com/apps/deploy-apps/prepare-to-deploy.html#exclude
The solution is to delete the directory node_modules from your app directory before to push it. The description of the needed modules must be in the file package.json under dependencies. I tested a simple express app adding the material-design-icons module. Pushing the application without the content of the directory node_modules works, since in staging the modules are downloaded and added to the application.
The solution is to delete the directory node_modules from your app directory before to push it. The description of the needed modules must be in the file package.json under dependencies. I tested a simple express app adding the material-design-icons module. Pushing the application without the content of the directory node_modules works, since in staging the modules are downloaded and added to the application.
The solution with .cfignore should work. You might need to delete and re-push your app though, since Cloud Foundry caches some files and the container might be filled with these cached files. If you delete and re-push the app, you're getting a clean container from scratch which might solve your problem.
I have faced the same problem. I solved it by doing the following:
Using .cfignore
Specifying the update nodejs in package.json
Using the latest buildpack

Copying non-existent resources during iPhone build

At one point in my iPhone app development, I had 2 rather large video files as resources for use in the app. After some tests, I decided I didn't want them anymore. So I deleted both from the resources folder in xcode - and I selected 'remove and delete selected references.' When I try to build on my iPhone or iPad, it still says "copying file opening.mov to iPhone." And it takes up space in the build.
What is happening? I deleted all references to the file everywhere on my computer, but it still copies the file on my iDevices.
I checked the xcode project folder in finder and it's not there!
You can go to Project->Build Phases->Copy Bundle Resources, chances are those files are still there somehow, delete them if they are.
Additionally as suggested do a product clean.
Go to /Users/your user/Library/Application Support/iPhone Simulator/your version/Applications and delete the folder for your app.
Hint: Library could be a hidden folder. If you not see it use tinker tools to make the folder visible.
Delete the app on your test device.
In xcode go to Build Phases and check if your file is copied to bundle resources. If yes - delete it from there.
Clean your build an run.

Can Xcode include application resource files that are generated during the build process?

I have a bunch of content files for my iPhone app that I generate via shell script. It takes way too long to be a part of the Xcode build process, so I run it periodically.
I don't want to have to continually add these files to my Xcode project in order to get them included my app resources folder. Is there a way to get Xcode to copy the contents of a folder into the app resources at build time? (It'd be a bonus if I could specify other locations, such as the approot documents folder.)
I tried adding a new 'Copy Files Build Phase' to my target, but that didn't seem to work. This seems like a common problem, but I couldn't find anything about it here.
-- Edit (What I did)
Per Jasarien and cdespinosa's suggestions, I did the following in a build script. I decided not to copy to the destination, because that would only work when using the simulator, I don't think that'll work when deploying to a device.
cp -rf "$PROJECT_DIR/mystuff" "$CONFIGURATION_BUILD_DIR/$CONTENTS_FOLDER_PATH/"
-- Edit 2
This doesn't appear to get files onto my iPhone. Any ideas?
You can setup a Run Script build phase in your app's target. Write the script so that it copies the resources into the app bundle.
This is the path i use for output:
${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
Just copy your files in that directory, it's the bundle (simulator or device).
You can also take a look at my answer here : how to set up a Xcode build rule with a variable output file list?