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.
Related
I am very new to .Net6 and .Net Core in general. I understand that it is possible to publish a single file executable but I was a bit surprised to see that the executable is over 180MB even though the application is relatively small.
The application is targeted to Windows x64 only and uses Windows Forms. It has a handful of Forms and uses a JSON library and a CLI library.
There are a number of dependencies which were more-or-less added automatically but I don't know if they are all strictly necessary (e.g the ASPNetCore item)
Bearing in mind that I am only targeting Windows and the featureset used is limited, what are the actions I can take to reduce the size of the executable?
Update
I found https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained which seems to indicate that 'trimming' of WinForms apps is not (yet) possible.
If you already did not, you may switch deployment mode to Framework-dependent from self-contained in publish profile settings, this will exclude .net runtime and will reduce file size dramatically.
However, excluding .net runtime, diverts from its purpose being single file, as you need to install correct runtime to use application. In my opinion, it is worth to keep single exe file with runtime included.
Use This code into your application.
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
Qt's resource system lets you build an executable that has resources (.qml's, images...) embedded inside it. I'd like to load the files from the filesystem instead, and ship them alongside my executable. Is this a technique supported by Qt? Any gotchas? Any advantages to one way or the other?
Qt doesn't limit you in what you can do here. It's your choice. Qt's resource system is there if you want it, it's not forced down your throat. Not using it doesn't make you automatically wrong.
If you want to deploy files along with your application, go for it - if it makes sense for your particular application.
My personal preference for small (<0.25GB) applications is for a nice monolithic portable executable on Windows, with everything inside, that you don't have to install if you don't wish - mimicking how an app bundle would be on OS X.
The portability helps, as does the slightly stronger locality of reference: most filesystems will attempt to keep a file's blocks together a bit harder than they do for files that merely are in the same folder.
If there's any utility in power users tweaking the contents of the deployed files, then certainly using the files over using resources has advantages. You could also use the resource system as a fallback for files that are missing - that way a user could provide a replacement file optionally, if it's something you could use.
To make it short: If it is applicable for your application and 'business model' it is ok.
Besides being supported by Qt using QFile (for example), Qt's resource system has some advantages:
compression (ZIP)
simple usage in the application
no care about missing files (typically)
If you mind adding all resources to the executable will not work for you and you want to seperate them, look at the option of seperate (binary) resource files with Qt.
can any one help me that where is the SWC or run time library for the flex controls exist in the system?
Or can we provide our own library by using the controls in the dir
C:\Program Files\Adobe\flex_sdk_3.2\frameworks\projects\framework\src\mx
It is not very obvious what are you trying to ask but I'll try to guess :)
So the SWC with Flex controls is located here {Flex.SDK.root}/frameworks/libs/framework.swc and the corresponding RSLs are located here {Flex.SDK.root}/frameworks/rsls.
What about providing your own library to replace Flex controls I think it is not the right way. The best practice is not modify Flex SDK installation to have possibility to build your project on every computer with different environments (on a different developers computers or on client site).
And you should take in mind there are 4 standard ways to use code in Flash application:
Compile your code into SWF.
Use Runtime Shared Library aka RSL (which is SWF too).
Use SWZ which is signed and can be cached by Flash Player.
Use modules which are SWFs.
None of these ways doesn't suppose using Flex SDK in runtime. Flex SDK is being used only in process of building of your application.
So the best way to use some custom controls is to build them with your application using one of the ways I described above (excluding SWZ's which can be produced only by Adobe).
Just leave Flex SDK installation without changes and place classes/SWCs with custom controls in your project's classpath.
Hope this helps.
I'm trying to compile an existing Flex3 project with the Flex4 SDK. I'm getting this error:
Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option.
The resulting file is roughly the same as my old Flex3 compiled .swf file. Playing the resulting .swf file in the Flash Player also gives the following errors:
An Actionscript error ocurred: VerifyError: Error #1014: Class spark.core::SpriteVisualElement could not be found
If I set the compiler attribute static-link-runtime-shared-libraries to true, then the error disappears and all is well. However, the size of the resulting .SWF is a couple of 100K's bigger. And that's not what I want.
I don't fully understand the concept of runtime shared libraries, but it seems that with the option to statically link them set to true, the libraries are included in the .swf. However, I like to exclude them from the .swf and only load the needed library at runtime, as my project seemed to do with Flex3 (I didn't know that by the way).
If I understand correctly, playerglobal.swc should hold all the necessary code for the external libraries that my .swf has to load. Do Flex4 compiled files need more libraries? Should I do something with the factoryClass in the Frame metadata tag?
I think my question boils down to this: How do I compile a Flex4 .swf that is the same size as my previous Flex3 compiled .swf?
You have to add [Frame(factoryClass="path.to.your.preloader")] to the main class (the one you set in the compiler options).
Flex3 did not use rsls by default but you could enable them. Flex4 rsls are enabled by default, see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html
The concept of runtime shared libraries is: splitting of a part of your application that is (re)used by other apps as well, thereby only requiring the user to download it once. This won't save anything on the first download but will save on later downloads. You could possibly make your own rsl, but it's mostly the ones provided by adobe that are meant to make the difference: Since 'everybody' will use them there will be a bit chance the library you need is already present on the user's system, thereby speeding up the download-time of your app.
playerglobal.swc never contained any flex framework classes, most of them are in flex.swc and framework.swc (a standard flex 3 project also includes rpc.swc and utilities.swc - I didn't check but these probably contain some flex parts as well)
Looks like you might have project migration problems. You might want to read up on the process on:
http://www.adobe.com/devnet/flex/articles/flexbuilder3_to_flashbuilder4.html
It's a really good article with overview of different possibilities for migration, depending on the amount of Flex4 stuff you want to use.
Whats the best way to deploy a QT app? I've read the documentation hosted at trolltech but is it better to link with a static library or the dynamic libraries and have the user install the framework? I don't really want anyone using my app to have to download a 160mb framework just to run a simple gui frontend.
On OS X it's a good way to do a dynamic build and post-process the resulting ".app" with the macdeployqt tool which comes with Qt starting with 4.5.
This will copy the Qt frameworks used by your application into the application bundle, which results in a larger package than building a static version of your application.
Here is what you can do to make sure you get the smallest file size possibly in a dynamic build:
First off, make sure you only include the stuff you need (in the project.pro file's QT += core gui network xml lines).
Open the application bundle and remove any unneeded "Qt Plugins" from the bundle. macdeployqt automatically compies all the Qt plugins in there, which can be kind of bulky.
Make sure you are building your application in release mode. Otherwise your application might be linked against the debug libraries of the Qt4 framework, and they are really big (for instance, well over 90 MB for the debug library vs. 16 MB of a release variant without debugging symbols). This might be what happened in your case.
If you have a large application binary, you can use UPX to compress your executable file by 40-50%.
Other than that, you should use compressed disk images to deploy your application.
One of my projects uses QtGui, QtNetwork, QtCore and QtXml and the resulting bundle is about 16 MB in size.
Hope that helps.
Unfortunately you will have to include the Qt libraries you need into your own bundle, as you cannot expect your users to have Qt installed on Mac (whereas on Linux packaging systems allow you to require at least a given version of Qt.
There is a nice tool to help you with that, which is called macdeployqt. You just need to invoke it on your bundle application and it will pack the required libraries, changing the linkage of your binary to refer to them. Without it, making bundles for Mac is a real pain (it still is, but considerably less though).
http://doc.trolltech.com/4.6/deployment-mac.html#the-mac-deployment-tool
Afterwards, you can make a .dmg image as you would do with any other app. There is an option in macdeployqt that builds a basic one.
On Linux, it's better to rely on the OS's copy of Qt, as it's almost certainly installed - for OS X, almost all apps use a statically compiled library.