tns build android 《app-debug.apk》package too big - nativescript

my project code size only 2M ,but by command: [tns build android ] create 《app-debug.apk》 size 78M.
nativescript-vue project

NaticeScript adds node_modules dependencies in build and that's the reason for increased size of android and ios app.If you want smaller size you can opt for native android/ios app.

Use release version of APK and not the debug one.
Try a clean build, sometimes the node_modules folder is copied as it's by mistake (not exactly sure why / when it happens), a clean build mostly resolves the issue.

Related

Optimizing Xcode Build time when using Firebase library

Since I'm building using FireStore and few other Firebase library, the build time has doubled down. I'm wondering if there is a way to avoid compiling it every time I clean & build my project.
Don't clean & build, just build. ;)
Disclaimer: Before doing releases, a clean build is preferred, of course.
UPDATE with better answer: Use cocoapods-binary plugin.
https://guides.cocoapods.org/plugins/pre-compiling-dependencies.html
One solution for this is to not give Xcode the chance to re-compile code. CocoaPods Binary will pre-compile your Pods during pod install, and then add the binary assets (e.g. .framework files) into the generated Xcode projects instead of the source code.
Like this.
plugin 'cocoapods-binary'
use_frameworks!
target "MyApp" do
pod "NeededPod", :binary => true
end
For anyone stumbling on this post, we finally found a way to optimize Firestore build time while still using cocoapods.
We are using THIS REPO
It's a precompiled Firestore iOS SDK xcframework files extracted from the Firebase iOS SDK repository release downloads, tagged by Firebase iOS SDK version and presented as a consumable podspec.
Why
Currently the Firestore iOS SDK depends on some 500k lines of mostly C++, which when compiling as part of your Xcode build takes a long time - even more so in CI environments.

Flutter version information not used by Xcode

In my iOS project, I have the following settings in the Runner -> General tab, under the Identity section:
Version: $(FLUTTER_BUILD_NAME)
Build: $(FLUTTER_BUILD_NUMBER)
which is the same as when creating a brand new Flutter project. However, when I was going to create an Archive for releasing my app, Xcode complained that those fields were missing or incorrect (I don't remember the exact error message).
The only way I could build the release app was to change them to hardcoded strings - i.e. 1.0.0 and 1 respectively. What could be causing this issue? It would be a nuisance to have to remember to update those for every release, and I shouldn't have to, right?
If you created this project with an older Flutter version
several files created in the ios/ and android/ sub-directories might be outdated.
Newer Flutter versions might generate these files a bit differently and projects created with older Flutter versions might cause issues.
Ways to fix
Delete the ios/ and android/ directories and run flutter create . to re-generate these directories.
HINT
Custom changes will be lost and need to be re-applied. This is easiest if the project is committed to a version control system like Git.

Nativescript advanced seed Android APK build size

I'm using Nativescript advanced seed project to start with a sample project. The sample project as is, got built and deployed to my device taking arround 100MB, which seems to be a lot considering no new screen added(except for the default 2 screens).
Is it because of the other platforms libs included in the base project?
Is there anyways to disable unused libs to reduce the apk size?
Its not because of the other platform libs, which will not be included in your Android/iOS build. In other words,each platform build has its own command, which will include only that platform specific files. Ex. Mac related wont be present in the Android build.
App size is currently an issue with Nativescript. You might be doing a dev build. When you do PR build with below platform specific commands, base size will be around 50MB.
Android: npm run build.android
iOS: npm run build.ios
Size wont increase exponentially as you add new screens, as the most of the size is coming from nativescrit base web dependencies to execute the JS files in the run time.
More on webpack here -> https://discourse.nativescript.org/t/how-to-decrease-app-size-and-release-it-using-webpack-and-nativescript/798

Gradle incremental on different machines

We have multiple GitLab runners on different machines.
We broke our pipeline in multiple steps that are dependent and I see that gradle doesn't run incrementally.
For example, we have build apk and upload apk to hockeyapp. We always copy apk output from one step to another. However gradle still start building apk from scratch because upload needs it.
How can I troubleshoot it?
What folders to copy to make sure gradle runs incrementally?
We are on Gradle 4.x (4.1 and moving to 4.2)
I don't think you should do this. You would probably need to copy over the .gradle directory from the root project, but I'm not sure this works too well and as expected. I guess you should instead use the new Build Cache which sounds like being exactly what you need in your situation and is an official feature and does not involve some unsupported copying-around of build metadata.

Build an archive of Phonegap project in Xcode

I created an Phonegap app for iOS devices. It works fine on my connected device, but if I want to archive the app to get an .ipa file I get errors from the compiler.
Do I have to change something in the Build Settings?
A couple of things to try:
Go to the Build Settings, then Linking, then find Other Linker Flags. Then change $(TARGET_BUILD_DIR)/libCordova.a -----> $(BUILT_PRODUCTS_DIR)/libCordova.a
Under Build Settings in Architectures, change Build Active Architecture Only to YES.
I'd try both these methods for the Project and Target. Hope this helps!

Resources