Thursday 16 February 2012

Linux / Ubuntu - Steps to Compile QTMultimediaKit inside QT Mobility 1.2



Steps to Compile QTMultimediaKit inside QT Mobility 1.2

QT ships its valuable Multimedia Kit inside QT Mobility. Now this kit is shipped only in the QT Mobility package which is available for Mobile platforms, for QT Mobility package which are meant for the Desktop OS such as Linux, Windows or Mac, this multimedia kit is unavailable. i.e. If u want to use the valuable elements of this Multimedia Kit in your QT Desktop application then you are out of luck. However, by following the below steps we can compile the unavailable QT Multimedia Kit for Linux / Ubuntu and then make its elements available for our QT application.

  • First we need to place the “qmake” of Desktop framework in our path. for this we will make its symbolic in /usr/bin, Moreover if u have any already present "qmake" item present inside this directory then make sure to remove it before applying the following commands :
    • cd /usr/bin
    • sudo ln -s /home/junaid/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake qmake
(In this case I have my QTSDK placed in the /home/junaid. This has to be changed according to ur own arrangements )
  • Get the source code for QT Mobility 1.2 from http://get.qt.nokia.com/qt/add-ons/qt-mobility-opensource-src-1.2.0.zip
  • extract in the desired folder. NOTE: All the libraries and required files will be created in the extracted folder. So place this extracted folder at a place where u can easily locate your libraries.
  • Before going Forward to Compiling the Multimedia kit inside this Mobility framework, We will first install the (known) dependencies. execute following commands in the terminal to make sure that you fulfill the dependencies:

    • sudo apt-get install gstreamer0.10-x
    • sudo apt-get install gstreamer0.10-plugins-base
    • sudo apt-get install gstreamer0.10-plugins-good
    • sudo apt-get install gstreamer0.10-plugins-bad
    • sudo apt-get install gstreamer0.10-plugins-bad-multiverse
    • sudo apt-get install gstreamer0.10-plugins-ugly
    • sudo apt-get install gstreamer0.10-ffmpeg
    • sudo apt-get install libgstreamer0.10-dev
    • sudo apt-get install libgstreamer-plugins-base0.10-dev
    • sudo apt-get install libgst-dev
    • sudo apt-get install gstreamer0.10-alsa
    • sudo apt-get install gstreamer0.10-pulseaudio
    • sudo apt-get install libglui-dev
    • sudo apt-get install libasound2-dev
    • sudo apt-get install libxv-dev
    • sudo apt-get install libxv1
    • sudo apt-get install libxvmc-dev
    • sudo apt-get install libxvmc1
    • sudo apt-get install libxvidcore4

  • Now That our dependencies seems fulfilled, we can move forward to compile our QT MultimediaKit. (Please Note that in my case the downloaded source is present in /home/junaid/Downloads/qt-mobility-opensource-src-1.2.0 )
    • cd /home/junaid/Downloads/qt-mobility-opensource-src-1.2.0
    • ./configure -modules multimedia
    • make
    • sudo make install
  • In the above commands we have explicitly mentioned that we want to compile only the “multimedia” Module of the QT mobility framework, hence the “make” and ‘make install” commands only compile the code that completely builds the multimedia kit inside mobility.
  • Now once we have our libraries and other required files compiled and installed, we need to do one Last and very important step without which all our efforts will be useless i.e. we have to export the Library Path in which the compiled libraries are placed.
  • Above steps will place the libraries at “/home/junaid//Downloads/qt-mobility-opensource-src-1.2.0/lib” so we will export this path using following command
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/junaid/Downloads/qt-mobility-opensource-src-1.2.0/lib/

Now you are all set to utilize the multimedia components of QT mobility inside your QT or QML application for Linux/Ubuntu. Enjoy :)

Friday 10 February 2012

Android - Setting Up Development Environment.


Setting Up Android Development Environment.

Okay I know this is very basic thing but as my blog says, its Knowledge Dump, Any thing big or small should be shared so here i go. Setting up Android development environment consists of following very easy steps:
First 2 steps are pretty straight forward and self explanatory. However, the 3rd step needs some explanation and is mentioned in the below section.

Setting Up Android SDK inside Eclipse:

Ok now that we have our dependencies and IDE ready, we need to integrate the Android’s SDK and Android Development tools with our IDE i.e. we have to make our IDE capable of developing Android Applications. For this First we will have to install the Android Plugin for Eclipse so that it can help in the integration of Android SDK tools and Android Development Tools with our Eclipse IDE.
For Installing Android Plugin open Eclipse->help->Install New Softwares. Click ‘Add’ and this will show you a dialog having ‘Name’ & ‘Location’ fields. Enter any name in the ‘Name’ field say Android Plugin or ADT Plugin. In the ‘Location’ field enter https://dl-ssl.google.com/android/eclipse/. If this doesn’t work then try the link with simple “http”. Click ‘Ok’ and eclipse will show you the available softwares/plugins on this url that can be installed. Select all and install them.  Once Installed Eclipse might ask you to restart the IDE.
 Restart the IDE and now in ‘Window’ menu you can see “Android SDK Manager” and “AVD manager”. Select the “Android SDK Manager” and it will show you available Packages such as Tools, SDKS and Extras. Select available packages in ‘Tools’ and at least one SDK say “Android 2.2 (API 8)” and then Install them. Once Installed you are all set to develop applications for android by simply going into File->New->Other->Android Project.

Papa Reference:

Android - Steps for Signing & Making Publish Ready App.


Android - Steps for Signing & Making Publish Ready App.

Following are the steps involved in Signing and making your Android App publish ready. These steps should be followed in the same order as written in this document while Publishing an App to Android Market. Before you move towards the Signing and Publishing Steps; there are few things you have to take care in your App.
  • First of all we need to do proper versioning of the App. Versioning is important for the future updates. There are 2 fields in the Application Manifest file that determines the version of the App. First is “android:versionCode”  this represents the number of times the app is being put on the App Store. For first time it is “1”. Second Parameter is “android:versionName ” this is the version that u want users to see. It is a string and can contain major,minor version name. e.g “0.8.5
  • Once versioning is done next thing is to declare minimum, target and maximum API Level in the manifest file. Its good to mention just minimum SDK Level.
  • Disable : “Debuggable” & “Allow Clear User Data” in the Manifest File. 
  • Disable all the Logs in your app.
  • Register for a Maps API Key by sending the MD5 hash of the certificate with which we are going to sign our application. Once we get the Maps Api key then we use it in our application by mentioning this in the mapview layout( if your application is using MapView element). There are 3 steps of generating Maps api key for the application, first is to locate the “keytool” in your JDK, then use it to generate the MD5 hash of the certificate with which you are going to sign ur application. And finally use this MD5 hash to get the maps Api key.
  • To take the MD5 finger print hash of the certificate we first have to make sure that the ‘keytool’ is in our windows PATH variable. If not then add the path of the keytool in ur environment variable. The keytool needed for generating the MD5 hash is present in the “bin” directory of ur JDK i.e. the path will be something like this: C:\Program Files\Java\jdk1.6.0_17\bin
  • Once u have added the path of keytool in ur environment variables then open the command promp and use the following command to generate the MD5 hash
keytool –list –alias Appkey –keystore c:\MyKeystore
here the “Appkey” is an example alias for the key present in the example keystore “MyKeystore” located on the ‘C’ Drive
  • The above command will ask u for the password of the key and will then generate MD5 hash of the certificate.
  • Go to http://code.google.com/android/maps-api-signup.html and enter the MD5 fingerprint of the certificate calculated above and hit the “Generate Api Key” Button and get the Google Maps Api key. Now use it in the xml layout of the MapView.
  • Now we can proceed towards signing and publishing.
  • You should first Compile the application in Release Mode to get an Unsigned “.apk” package, Sign it using the keystore and then finally Align the package with zipalign.exe.
  • The above steps of Release Compile, Signing and Aligning can easily be done using Eclipse Export tools. Moreover it can also Create a KeyStore if u don’t have one.
  • Keystore contains the keys being used by you for signing application. The keys can be referenced in the keystore by there Alias.


Note: Keystore can contain number of Keys and each key in the keystore references to a Certificate binded with it. Moreover, both keystore and keys have their own Passwords however its more convenient to use the same password for both keys and keystore.

Papa Reference