3

I upgraded my ubuntu 14.04 to 14.10 to use the latest ubuntu-sdk. But When I created a simple UI project there is just a red wave line under the "import Ubuntu.Components.1.1". So I moved my mouse to the red wave line. A window poped up showing like this literally:

Errors while reading typeinfo files:
   Failed to parse 'usr/lib/x86_64-linux-gnu/qt5/Ubuntu/Component/plugins.qmltypes'.
   Error:/usr/lib/x86_64-linux-gnu/qt3/qml/Ubuntu/Components/plugins.qmltypes:632:19:Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'.
/usr/lib/x86_64-linux-gnu/qt3/qml/Ubuntu/Components/plugins.qmltypes:633:36:Expected array literal with only number literal members.

What does this lines mean? How can I solve these problems?

2
  • Two things I notice: First, the import line should be import Ubuntu.Components 1.1, with a space instead of a period between the module and the version. But that shouldn't lead to the error you report. Can you check that this is correct? Second, some of the error lines report qt5 while others say qt3. If this is true, then your Qt install is really messed up. But perhaps you mis-typed. Can you clarify? Nov 29, 2014 at 18:14
  • Yes,sorry, I mis-typed. Indeed, it was qt5 instead of qt3. Second, I'm sure the import code was right because I created the project with default status and I did not change anything.
    – Wayne
    Dec 1, 2014 at 3:07

3 Answers 3

2

I was having the same problem today, however, I just discovered the solution (and what the error was specifically).

The problem is the qml plugin files required are not in the currently specified include directories.

If you make a new app and select App with Simple UI, there will be a file called [projectName].qmlproject in the app project root directory.

On mine, the include was near the bottom of the page, like this:

/* List of plugin directories passed to QML runtime */
    importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml"]

I ran find / -name *qml* and found something that looked to be a suitable directory, with many items that had a good chance of being qml plugins, so I copied that directory, went to [projectName].qmlproject to the statement posted above and added the directory. The final importPaths statement looks like this:

/* List of plugin directories passed to QML runtime */
    importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml","/var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/" ]

After doing that, I could open the qml file in designer in that project as well as in another that doesn't have a qmlproject file, so I assume the memory of the directory was retained.

The issue is, however, that it's looking in the wrong directory for the qml plugin files, so find those and a way to include them (the way specified above solved the issue for me).

2

I had the same problem, to fix it I edited the plugins.qmltypes file. Follow the path in the error message, you need superuser permissions. The error message says some lines could not been parsed. Looking at the file, the lines are contained in some kind of JSON object, in my case, at the end of the file. I removed the whole object and it worked.

Component {
        prototype: "QObject"
        name: "UbuntuColors"
        exports: ["UbuntuColors -1.-1"]
        exportMetaObjectRevisions: [-1]
        isComposite: true
        isCreatable: false
        isSingleton: true
        Property { name: "orange"; type: "QColor"; isReadonly: true }
        Property { name: "lightAubergine"; type: "QColor"; isReadonly: true }
        Property { name: "midAubergine"; type: "QColor"; isReadonly: true }
        Property { name: "darkAubergine"; type: "QColor"; isReadonly: true }
        Property { name: "warmGrey"; type: "QColor"; isReadonly: true }
        Property { name: "coolGrey"; type: "QColor"; isReadonly: true }
        Property { name: "orangeGradient"; type: "QQuickGradient"; isPointer: true }
        Property { name: "greyGradient"; type: "QQuickGradient"; isPointer: true }
        Property { name: "lightGrey"; type: "QColor"; isReadonly: true }
        Property { name: "darkGrey"; type: "QColor"; isReadonly: true }
        Property { name: "red"; type: "QColor"; isReadonly: true }
        Property { name: "green"; type: "QColor"; isReadonly: true }
        Property { name: "blue"; type: "QColor"; isReadonly: true }
        Property { name: "purple"; type: "QColor"; isReadonly: true }
    }
1

My solution was to change the plugins.qmltypes file:

This bug is caused by setting exportMetaObjectRevisions to [0,0] on Component blocks that only have one export defined. Deleting the comma and the second 0 fixes this.

This change needs to be applied on lines 1058, 1067, and 1085 of the following file:

/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/plugins.qmltypes

Once I made those changes, I was able to enter the design page for a new QML app with qmake without encountering a blocking popup block.

I am running a fresh install of Ubuntu 15.10 with an amd64 architecture; other architectures may need to replace the x86_64-linux-gnu part of the file path with something more system-appropriate.

More infomation #2:

https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1511728

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .