I have built a xamarin forms app and android size 17mb using proguard, full linking.
However UWP size is 76 mb. I am already using configuration as in the screenshot below.
I am support x86, x64 and arm architectures on both platforms. in android i create separate packages per abi. thats why 17mb is each abi size. but I couldnt find a similar option in UWP. it is size of bundle.
is there a way to provide 3 installers? Beside that why is the size too large and how can i optimize it further?
PS; on native side, i dont have much code. 95 of the code is in shared project even images are embedded in shared project. plus, android has more images.
EDIT: I tried the option "include full PDB files" by unchecking but it didnt help me at all. it only reduced 2 mb size.
Related
I am using Visual Studio For Mac. My Xamarin Forms project is quite large and contains many content pages. Some of them will be only used in android project and some of them only used in iOS project. There is no problem when I compile the project into android. However, when I want to compile the project into iOS, it seems like did not accept anything related to android. Please refer to the screenshot. There is no way I can include the android specialised reference and compile into iOS project. So, any idea to deal with this? Maybe there is a way to force build the iOS project no matter what? The error from the screenshot is from the page that will be only used in android. So what I can do for now is delete the page when I want to compile as iOS and recreate the page when I want to used it for android. But there are plenty of them, it is too heavy for me to do this every time. Please help.
You can't call platform specific APIs at the .NET standard libraries that are used to host Xamarin.Forms code by default.
Basically you have those options:
1) using shared project instead of library and using conditional compiling (easier but it is now not available as the option when creating the project)
2) using dependency injection.
I created Android app with Xamarin Forms. For release I use option "Bundle assemblies into native code".
My apk have size - 17 Mb, without this option 33 Mb. Do I need to use obfuscation for my libraries or my code is protected?
I searched a lot - but I did not find an exact answer.
Bundle Assemblies into Native Code means:
When this option is enabled, assemblies are bundled into a native shared library. This option keeps your code safe; it protects managed assemblies by embedding them in native binaries.
Keep it safe :
These will bundle the .dll files into a .so file so that they are harder to tamper with on a rooted device. As BobFlora said : it will be moving IL code in with the native binaries(.so file) so it's harder for hackers to mess with it. There's no performance issue here.
Reduce apk size :
This option will reduce apk size dramatically since .so files are compressed and dlls are not.
I create an empty project, we could find the difference when use this option :
Didn't use Bundle Assemblies into Native Code :
Use Bundle Assemblies into Native Code :
Do I need to use obfuscation for my libraries or my code is protected?
It is helping increase code obfuscation (specifically on Android), and there are other ways to increase security/cryptography. If you had tighter security requirements, you could use this option, it depends on your requirement.
When I launch my deployed application from the .exe file the layout is messed up. When I launch the app from Qt Creator, the layout is fine.
Here are the details about how I deployed my app. I am using Qt 5.5 and MinGW 32 bit 4.9.2. I am running Windows 10.
First in Qt Creator I built for release.
Next, I opened the Qt 5.5 for Desktop (MinGW 4.9.2 32 bit) console.
I navigated to my project folder and ran
windeployqt.exe --release ./APPNAME.exe
It copied all the necessary .dll and created some folders as expected.
Now when I run the app, it seems to work just fine. But the layouts are all wrong. Again, when launching the app from Qt Creator it looks great! Proper spacing and sizing of my widgets. When I launch the .exe every thing is smooshed, the ratios of my sliders are all wrong, and some text is hidden because of crowding.
What could cause this bad layout? Am I missing some dependency somehow?
I figured out my own question. The issue was not my build or my layout but that many sizePolicy parameters don't seem to take effect when launching the app from QtCreator. Not 100% sure on the explanation but I think that when launching the .exe the OS is managing interpreting some of those size policy parameters and it does it differently (perhaps more strictly it appears) than QtCreator does. (To be clear I'm not talking about how the app looks in the Design tab. I'm actually talking about launching the app from within QtCreator)
So to fix the appearance of the app I have to play around with the size policies and parameters, build, and then launch the app from the executable.
I was testing with simple qt quick application on android & ios device. For android,memory usage is 31 MB where as for IOS it jumps to 41 MB.
Installing through ministro requires active internet connection.Upon deploying,I see a lot of Qt libraries getting added,can't we remove it?
Installed Qt libraries should only the ones used by your project. See your .pro file and remove unused Qt dependencies (QT flag).
For the size difference, I'm pretty sure deploying on windows will require a different memory usage. It's hard to say why one uses more memory. Every platform and compiler have there specificities and will end up with different binary sizes. There could be some compiler options to optimize by size, but speed peformance will be shown down.
I have been using Qt for a while on Linux and Windows. However, yesterday I picked up a new MacBook Pro so naturally I've been playing around to see if I could build my Qt apps on Mac.
I got pretty much everything working, however there is one problem : the file size of the resulting app bundle.
I am building my application like this:
qmake -spec macx-g++
make
macdeployqt my.app -no-plugins -dmg
The bundle and everything seem to work fine, but, the generated .app is 31.1 MB large and the .dmg is 13.6 MB!
Is this normal? Can I reduce this horrible size (on Windows, my installer for the same app with all the libraries is ~4 MB)?
If you are using the pre-built Qt libraries then the chances are that they are universal binaries with multiple architectures. For example, do $ file my.app/Resources/Frameworks/QtCore.framework/Versions/4/QtCore and you will see multiple architectures.
You can build your own Qt libraries with only the architectures that you want to support. You may wish to not support PPC because that is ancient; or if you are using a current Qt then you can make the decision of 32 bit vs 64 bit, but that's another question.
The problem is the size of the Qt dynamic libraries, as they must be part of your bundle.
These sizes can usually be reduced.
See the solution of How do I make apps smaller with qmake and macdeployqt on how to do this.
An excellent workaround would be a static build of Qt and linking your application against the static build. This usually is a very good idea as two applications installing Qt dynamically usually crash on Mac OS.
Your application will have with static build (from my exp.) approx. 10-20MB of size. Combined with the steps above, some more reduction might be possible.