首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ubuntu-sdk创建有问题的应用程序

使用ubuntu-sdk创建有问题的应用程序
EN

Ask Ubuntu用户
提问于 2014-11-29 08:49:24
回答 2查看 1K关注 0票数 3

我将我的ubuntu14.04升级到14.10,以使用最新的ubuntu。但是,当我创建一个简单的UI项目时,在"import Ubuntu.Components.1.1“下只有一条红色的行。所以我把鼠标移到红浪线上。一扇窗户突然弹出,就像这样:

代码语言:javascript
复制
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.

这句话是什么意思?我怎样才能解决这些问题?

EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2014-12-11 10:58:09

今天我遇到了同样的问题,但是,我刚刚发现了解决方案(以及具体的错误是什么)。

问题是所需的qml插件文件不在当前指定的包含目录中。

如果您制作了一个新的应用程序并选择了App with Simple UI,那么在app项目根目录中将有一个名为[projectName].qmlproject的文件。

在我的页面中,包含的内容接近页面底部,如下所示:

代码语言:javascript
复制
/* List of plugin directories passed to QML runtime */
    importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml"]

我运行了find / -name *qml*并找到了一些看起来是合适的目录,其中有很多项目很有可能成为qml插件,所以我复制了这个目录,转到[projectName].qmlproject到上面发布的语句,并添加了目录。最后的importPaths语句如下所示:

代码语言:javascript
复制
/* 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/" ]

这样做之后,我可以在该项目中的designer中以及在另一个没有qmlproject文件的设计器中打开qml文件,因此我假设目录的内存是保留的。

然而,问题是它找错了qml插件文件的目录,所以找出这些文件和包含它们的方法(上面为我解决了问题的方法)。

票数 2
EN

Ask Ubuntu用户

发布于 2015-02-22 01:33:13

我也遇到了同样的问题,为了解决这个问题,我编辑了plugins.qmltypes文件。按照错误消息中的路径,您需要超级用户权限。错误消息显示某些行无法被解析。查看文件,行包含在某种类型的JSON对象中,在我的例子中,在文件的末尾。我把整个物体都移走了,它起作用了。

代码语言:javascript
复制
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 }
    }
票数 2
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/554540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档