I am new to V-Play. I just wanted to test it with Hello World app. My Single page app's Main.qml is 523 bytes only. But V-Play is building 20+ MB APK. Are Qt libraries that big?
This is the normal behavior; the thing is that the Qt libraries are not that small.
For instance, if you develop a QtQuick application, you have at least QtGui, QtCore, QtQuick dependencies.
If the size it's a problem for you, there is an alternative: use Ministro. Ministro is an Android service that provides Qt libraries, so different apps could share the main libraries.
See Using Ministro to Install Qt Libraries for more information.
Related
Am using Qt to build app on android, Qt Quick mainly its really nice, but my main problem is the start up size is around 27 MB which is huge for initial size.. is there a way to reduce this size ?
If you you don't want to use Ministro Service, you should include only the necessary Qt modules. Omitting the unnecessary modules will reduce the APK size significantly. This is a quote from BogDan Vatra the man who ported Qt to Android :
Qt files can go slightly over 40Mb/platform if you are going to use
all of Qt modules. Of course your application doesnt need all the
modules, so, if your application uses only Qt Quick Controls + Qt SVG
+ Qt Multimedia + Qt Sensors + Qt XML modules, Qt files (libs + plugins + additional files) are ~20Mb/platform and your APK will be
~10Mb.
You can see Choosing the right deploying system
Yes. You are most likely bundling Qt itself with your app. That's the default setting in Qt Creator. Go into your project settings (the Projects button to the left of the UI) and under Android/Run/Make Install, click on the Details button. There you can switch the Qt Deployment from Bundle to use Ministro Service.
This way your apk will be a lot smaller, but you need to install the Ministro Service from Play Store. Ministro contains Qt libraries that other apps can use.
Hope that helps...
From what I understand, native code on Android is code that works directly with the processor of a specific device. So if I wanted to take advantage of a certain processor I would use native code.
But what happens if I want to make an app that contains native code, but targets multiple processors?
Do I have to make multiple apps, one for each architecture? Or is there a way to put multiple version of the native code in one app picking the one matching the processor of the device it runs on?
The Android Native Development Kit is a suite of cross compilers and support libraries which can be used to produce shared object (.so) files targeting one or more of the officially supported Android architectures.
The Android application package (.apk) specialized zip file format allows inclusion of distinct native libraries for more than one architecture.
If you refer to the NDK documentation, you will see that there is a project configuration file which you can use to specify which architecture(s) your native code should be compiled to support.
This is usually referred to as cross compiling. Ie, you need a compiler than compiles X, your current code, for Y. It generates code for CPU Y, not X as is the usual case.
You need to target multiple CPU architecture only if you are developing a NDK application.
Create a file named "Application.mk" under the jni folder. Add this parameter
APP_ABI=
Example :
APP_ABI:=x86 armv7eabi mips
or you can all do this
APP_ABI:=all ( in which it would create the apk for all supported architecture)
but doing this you would generate a FAT binary and google play will take care of filtering the corresponding apk for different underlying architecture when the user installs your app.
I would like to use native library cUrl in my android project, but i'm afraid that there could be problems with different architectures.
I'm new to NDK, so it would be great, if you'll help me with that question.
Thanks in advance
If you are going to include a native library in your Android application, you need to build it for all possible architectures like arm, x86. If you don't your application won't work on devices that you don't provide builds for and also they won't be visible in Google Play for those devices. However within those architecture builds you are safe.
Android NDK provides all the necessary support to get you covered in this scenario, so you should start from reading there.
I can cross-compile any C/C++ application, statically link it Linux libraries and run it on Android. What was the need of an Android-ndk then? Android-ndk limits us to bionic which has a small subset of gnu libc. Isn't it a better idea to straightaway cross-compile applications and run them through Android shell? Is there any limitation to cross-compiling that I can't see? This URL : Can Linux apps be run in Android? answers my question to some extent but eventually leaves me confused and without clarity.
I think this is enough for Android-NDK
The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code. It provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. If you write native code, your applications are still packaged into an .apk file and they still run inside of a virtual machine on the device. The fundamental Android application model does not change.
The NDK provides:
A set of tools and build files used to generate native code libraries
from C and C++ sources
A way to embed the corresponding native libraries into an application
package file (.apk) that can be deployed on Android devices
A set of native system headers and libraries that will be supported
in all future versions of the Android platform, starting from Android
1.5. Applications that use native activities must be run on Android 2.3 or later.
This thing you can not find in other cross-compilation with arm toolchain..
As mentioned in the link http://developer.android.com/sdk/ndk/index.html NDK is a companion for App development folk to create performance sensitive native code. NDK exposes some of the native implementation of Android which could not be found in the general Linux environments. Some of them include the Android/Bitmap, Android/nativeWindow etc. Using these Android natives applcation can speed up CPU intensive processes like some compression or decompression of images.
Even though the externally cross-compiled executables may run in the Android there no guarantee that versions of the standard library implementaions are the same. NDK provides a easier and Android compatible toolchain and other resources, using which is much easier to application developers than having to find a compatible cross-compiler for their usecase.
I just read this question about packaging for Android:
Android - Application (apk) Maximum size
Where it mentions that apk files have a maximum size for the market place:
http://www.google.com/support/androidmarket/developer/bin/answer.py?hl=en&answer=113469
When using the Qt for Android:
http://sourceforge.net/p/necessitas/home/necessitas/
How much space does that take up?
You don't have to include the Qt libraries in your application so the space of the app depends only on the application itself.
The guy behind necessitas has also created ministro which fetches the Qt libraries required by your application.
Ministro is a system wide Qt shared libraries installer/provider
service. It acts as a bridge between your apps and Qt libraries.
Ministro service is release under GPL v3+ license.
Have a look at this [QuickStart video] which demonstrates the process of writing/installing a Qt Application in Android
EDIT
Of course if you want you can select to use deploy local qt libs with your application instead of the device libs. In this case the extra space required depends on the Qt modules you use.