Thursday, February 9, 2012

plugin cannot be loaded for module Cannot load library The specified module could not be found.

Hi, recently I had problems with a similar error from the title of this post.  The complete error is here:
plugin cannot be loaded for module "QtMobility.sensors": Cannot load library C:/QtSDK/Simulator/Qt/mingw/imports/QtMobility/sensors/declarative_sensorsd.dll: The specified module could not be found.
     import QtMobility.sensors 1.1 
Your error can be a little bit different from this. The text colored green can be different from the one you see. It all depends what resource you are trying to access in your code. Here is another example of the problem number 2:
plugin cannot be loaded for module "QtMobility.location": Cannot load library C:/QtSDK/Simulator/Qt/mingw/imports/QtMobility/location/declarative_locationd.dll: The specified module could not be found.
     import QtMobility.location 1.2  
Another one of these errors can look like this- problem number 3:
plugin cannot be loaded for module "QtMobility.systeminfo": Cannot load library C:/QtSDK/Simulator/Qt/mingw/imports/QtMobility/systeminfo/declarative_systeminfod.dll: The specified module could not be found.
     import QtMobility.systeminfo 1.2 

At the end of this article you will solution for these and similar errors.
If you still haven't figured it out this is one of those Qt Quick tutorials. You will need Qt SDK used to program for Nokia phones, Windows, Linux and few other platforms in order to see this error. I am using Qt SDK 1.2. For a solution, continue reading this post



In my case I wanted to create a simple app that shows data from accelerometer built in my Symbian or MeeGo (Harmattan) phone. I have written the code and when I ran it I received the error form above. Notice that I have imported QtMobility.sensors 1.1. Also I have checked and the file declarative_sensorsd.dll was persent at the path shown in error. The solution for this problem was pointed out to me on Nokia developer Discussion Board (DiBo) by the user vineet.jain. So I would like to take this opportunity to than him.

SOLUTION 1:
Go to the project file of your project. It is the file with the .pro extension. File name should be same as the project's name. You have to add two lines to it
CONFIG += mobility
MOBILITY = sensors
This will allow your app to use the sensors from your phone. 

SOLUTION 2:
If you are going to use GPS on your phone you have to switch word sensors with location.
CONFIG += mobility
MOBILITY = location
In order for your code to work on your phone you will also need to add the line
symbian:TARGET.CAPABILITY += Location
Without this line your code will work in the simulator but it won't work on the Symbian phone.
Read more about capabilities (Symbian Signed)

SOLUTION 3:
If you are going to use system information of your phone like battery level or something else you will have to add these lines to the .pro file
CONFIG += mobility
MOBILITY += systeminfo


If you want to use some other resources of your phone you can find out more in
QtMobility 1.2.1 Quick Start guide
http://doc.qt.nokia.com/qtmobility/quickstart.html

3 comments:

  1. Thanks alot , really you make my day

    ReplyDelete
  2. Thanks a lot! but what if I want to use both GPS, accelerometers and batterylevels in the same program?

    ReplyDelete
    Replies
    1. Hey schmarden!
      If you want to use all of those I think you should write this
      CONFIG += mobility
      MOBILITY += systeminfo location sensors

      Delete