flutter pods duplicate, can we make pointing on one folder? - ios

at the end of every project I always run flutter clean,
for example GoogleMapsCore
for one project
/Users/yogiarifwidodo/Sites/mobile/flutter/real_project/project_1_id/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
in this folder i have GoogleMapsCore and the size is 141MB
for the second project
/Users/yogiarifwidodo/Sites/mobile/flutter/real_project/project_2_id/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
in this folder i have GoogleMapsCore again and the size is 141MB
so my disk consume 141MB + 141MB + n (projects) = total.
how to make it global and just pointing to one folder so we reduce storage usage. Does anyone have some tricks?

Related

'Export to zip file' in Android Studio leads to 1.2gb + archive size

First of all, I am a complete beginner. I am always using 'export to zip file' to save my flutter code (I am not familiarized with Github right now ;-) ). The overall filesize of the zip is now around 1.2 gigabyte - Android folder: 60mb, iOS folder: 1.1gb.
It is a simple chat app without much graphics etc.
Is it normal? Don't want that the final app size is that large. Any idea how to save my code without that much overload?
Best,
Alex
Yes, that's normal - you have a whole bunch of intermediate build artifacts under your source folder.
The purpose of those .gitignore files that you find in your source tree is to tell git which files are the temporary build files or other configuration files specific to your machine. Git uses then to decide which files should be saved for posterity in source control, and which ones it should ignore.
If you are not going to use git, use the gitignore files to see which folders you can manually exclude from your zip file. (The build folder will probably be the main culprit.)
I highly suggest you use git. You can use dropbox or google drive folders for your project, this way they can auto sync your files. Try to compress your project folder from your operating system's file manager and compare the sizes. I don't think 1.1gb ios folder is normal.
Usually this must not happen (until u have used large media files).
One reason of file size increase is,
"apk / aab" files in "app\release" folder are not deleted while project is build,
like they are deleted in "app\build\outputs\apk\debug" folder.
You can delete previous signed apk from "app\release",
(if you have published them).
As these "apk / aab" are safely stored on google developer account.
Also don't forget to export your ".zip"
out of the project folder other wise it be like "zip in zip and zip in zip and so on ..."

Cocoapods dependency manager increase the size of xcode project or not?

I am little confused whether cocoa pods increase the size of our project or not. Although there is other many benefits of using cocoa pods.
I have search but they only said it will increase size only when you copy the repo.What happens if i will not increase the repo
CocoaPods keeps the external library files separate from your own source code.
If you mean “project” to be the actual .xcodeproj file and files it references, then no. It will not add to that size. (Other than changing some configuration options)
If you mean “project” to be all files associated with your app, then yes. Any package manager will do that because it’s downloading external files.
However, you can choose to not put CocoaPods’ files in source control (e.g. Git).
You can do one of two things:
Put all files into source control. This increases the size of your repo, but no one else needs to run pod install.
Put only the Podfile.lock into source control. This will make your repo smaller, but every time you clone the repo, you must have CocoaPods installed and run pod install.

ios project folder size is much larger than size of all the files in it

I found that my app new version is very large in size so I tried to clean some files in the project folder. The folder size is about 139 MB, but the size of the files inside it is only 49M. Screenshots are as follows. Is this normal? Because 139M is apparently too large for an app like mine, 49 would be acceptable.
Are you using git? Because git leaves a hidden directory, named .git, in your Project directory.
The size of your source directory has nothing to do with your final app size. You can't even estimate it that way.
You should archive your app and look at the size of the .app file. As explained here. That gives you an estimate.

XCode Framework Reference Paths and Build Output Directory

I have a workspace, Application.xcworkspace, that builds two frameworks and an executable that uses those frameworks. Here is roughly how they are laid out:
Framework_1 - Built and output to ugly DerivedData path.
Framework_2 - Depends on Framework_1, which is included in the Frameworks area of the project and specified in the "Link Binary with Libraries" Build Phase, and output to ugly DerivedData path.
Application - Depends on Framework_1 and Framework_2, which are included in the Frameworks area of the project and specified in the "Link Binary with Libraries" Build Phase. Output directory is again that ugly DerivedData path.
The problem I have is that the paths in the project file for the referenced frameworks are the DerivedData ugly path - they are like ../../Library/Developer/XCode/DerivedData/Application-longuglyuniquestring/Build/Products/Release/Framework_1.framework.
If I copy the source to another directory, or check it into version control and check it out to another machine, then those framework paths are no longer valid. They get re-generated. The referenced frameworks show up as red in the project.
So far, when I want to build the workspace in another folder, the way I have fixed the problem is to:
Build the workspace - Framework_1 builds.
Go to the "Products" node for that framework and show it in Finder.
Copy the new ugly path.
Open the project files for Framework_2 and Application and correct the path for Framework_1 and Framework_2.
All the red items should be resolved and everything should build.
That process is tedious and I am lucky the project file can be edited. It is worse for colleagues that do not understand the little I know about the project files, and just want to check the code out and have it build.
Is there something I need to do to the Build Output Directory for the frameworks? I have been leery of changing it since the ugly path is recommended. Is there a copy files option I can use to put those frameworks in some predictable location relative to my workspace?
Any help would be appreciated. I am sure I am missing something simple - it makes no sense that code checked out of source control or copied to another directory would not just build.
Looks like there is a way to set the DerivedData directory on a per-workspace basis - Xcode 4 - build output directory
I just set DerivedData to be relative to my workspace, then edited the project files accordingly. The only down-side is if I were to use one of those projects in another workspace that was using the default DerivedData path, I would have to change them back.
Many thanks to user DaGaMs - he got an upvote.
I am still seeing bad behavior from XCode 5: I got the project working on my machine. Copied it to another, lower, directory and verified it still worked. Exited XCode and copied the containing directory to a network drive, and from there onto another Mac. When I opened it on the other Mac it was like I never made some of the changes. Even worse, as I worked to fix it, XCode went nuts and added 6 extra '\' characters to each end of my FRAMEWORK_SEARCH_PATHS paths!
Part of the problem stems from the subproject directories in my app being absolute rather than relative. The projects in the top of the workspace are "Relative to Group", so I changed the subprojects to have the same attribute. That seems to have solved the problem, though for some reason when I copy all the files to another machine, the Derived Data redirection does not go with it.

Difference between cleaning and deleting the DerivedData folder

What is the actual difference between both these actions?
I ask because I find cleaning (Cmd-Shift-K) a slow, time taking process, and deleting the whole DerivedData folder much more faster.
More Info
1) I have set my DerivedData folder to be in a relative folder to my project folder in the XCode preferences.
2) I usually deal with projects with only one target. Very rarely I have to deal with 2 or more targets.
This is explained in Use Your Loaf's article on Xcode 4 DerivedData and Cleaning the Build Directory.
In Xcode 4 the Product > Clean menu option cleans up the build directory for all targets by deleting the app and dSYM files along with the precompiled headers.
DerivedData on the other hand contains other stuff:
Each workspace gets a unique set of symbol indexes, build products, window layouts, etc., otherwise referred to by Xcode as derived data.
So, the answer if you want to really clean everything, is to use the new Xcode 4 Clean Build Folder action by selecting the Product menu whilst holding the Option key. That will also delete the DerivedData contents:
Clean is slower, because it deletes file by file, not whole folder
After deleting DerivedData folder you'll get some slowdown, because XCode has to recreate indexes for your sources.
There is 'Clean Build Folder...' command (Option-Cmd-Shift-K, or select Product menu and press Option button). It removes folders not files, so it can be faster for you.

Resources