zoukankan      html  css  js  c++  java
  • 【使用Ubuntu SDK】入门篇——qtcreator 运行qmlscene时 module "Ubuntu.Components" is not installed 错误分析和解决

    从有Ubuntu要准备发布Phone版本就在开始关注了,尤其是其官方开发网站上的相关教程的阅读;前一段时间也试着搭建环境和进行初步的示例开发,网址为:

    http://developer.ubuntu.com/get-started/gomobile/

    现在更新后的教程是:

    Get the Ubuntu SDK preview

    The first thing you'll need to do is to install the tools and its dependencies. The installation will take place from PPAs, which are archives of packages that enable rapid delivery of updates. It’s an easy step that should take just a few minutes.

    Install Qt 5

    The Ubuntu SDK preview is built upon the latest version of the Qt framework, which we’re going to install now:

    1. Open a terminal by pressing the Ctrl+Alt+T key combination
    2. Enter the following command, pressing Enter at the end of the line and following the prompts
    sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper

    Install the Ubuntu SDK preview

    Once the dependencies are resolved, we’re going to install the Ubuntu UI toolkit as part of the Ubuntu SDK:

    1. If it wasn't open already, launch a terminal by pressing the Ctrl+Alt+T key combination
    2. Enter the following command, pressing Enter at the end of the line and following the prompts
    sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get install ubuntu-sdk notepad-qml

    当初没有这么好运,两行代码跟上面的有些出入,比如,安装的是qt5-beta1的ppa,而不是现在的qt5-proper,当时添加了个http://ppa.launchpad.net/ui-toolkit/ppa/ubuntu 的库,自动安装的Ubuntu的Components在/opt/qt5/imports/Ubuntu目录下,可是当前的更新后的qt-components-ubuntu包把文件都安装到了如下目录中:

    /usr/lib/i386-linux-gnu/qt5/qml/Ubuntu/

    虽然参考了一些教程,设置了环境变量:

    export QML_IMPORT_PATH=/usr/lib/i386-linux-gnu/qt5/qml:$QML_IMPORT_PATH

    也在测试项目中添加了路径配置代码:

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

    但是运行qmlscene的时候,还是提示错误:

    Starting external tool '/opt/qt5/bin/qmlscene' t.qml
    Got bus address:  "unix:abstract=/tmp/dbus-szRCO8tHBe,guid=9bef4d79deacf239b947461e512a167e" 
    
    Connected to accessibility bus at:  "unix:abstract=/tmp/dbus-szRCO8tHBe,guid=9bef4d79deacf239b947461e512a167e" 
    
    Registered DEC:  true 
    
    file:///t.qml:2:1: module "Ubuntu.Components" is not installed 
         import Ubuntu.Components 0.1 
         ^ 

    有待继续研究该路径和程序问题!总的来说是版本混乱了,要清理原来版本的配置、实现新版本的依赖和程序的调用关系!

    先分析新版本的Ubuntu-SDK里面的依赖方式:

    使用gdebi程序打开下载好的Ubuntu-SDK的开发包: ubuntu-sdk_0.1~bzr20130204-0ubuntu1~quantal1~test4_i386.deb

    该包中说明如下:

    Ubuntu SDK
    This package depends on all the needed packages of the Ubuntu SDK:
    * Qt 5
    * Qt Creator
    * Ubuntu UI Toolkit
    * Demos and examples 

    而进行qml文件调试的程序是qmlscene,应该属于qt5的开发包;故继续追踪新的安装路径:

    同样用gdebi文件打开包: qtbase5-dev-tools_5.0.0-0ubuntu1~quantal2~test3~nonupstreampatched2_i386.deb

    发现里面程序的安装路径为:

    /usr/lib/i386-linux-gnu/qt5/bin/

    新版Ubuntu-SDK的程序都安装在该目录下!重新配置qtcreator里面的qmlscene预览程序的路径,快捷键启动成功了!

    配一个截图搞定! 

    大家现在去按照官网说明安装相应工具后,也注意教程中调适工具的路径设置为新的哟!

    网站: http://developer.ubuntu.com/get-started/gomobile/#step-get-toolkit

    路径: /usr/lib/i386-linux-gnu/qt5/bin/

    更新后的教程应该是:

    Here’s a tip: although Qt Creator does not yet support qmlscene as QML viewer, you can invoke it from within the IDE. Here’s how:

    1. In Qt Creator, go to Tools > Options…
    2. Choose the External Tools tab, then in the pane select the Preview (qmlviewer) entry
    3. On the Executable: field on the right, replace the contents with  /usr/lib/i386-linux-gnu/qt5/bin/qmlscene.
    4. Optionally change the command name by double-clicking on the Preview (qmlviewer) entry from above. You can call it Preview (qmlscene).
    5. Click on OK to save the changes.

    Now you’ll be able to view your app through the Tools > External > Qt Quick > Preview (qmlscene) menu entry, from within the IDE and you won’t need a terminal anymore.

  • 相关阅读:
    线性表算法设计题2.11
    硬币抛掷模拟(使用数组)
    循环列示例(约瑟夫环问题)
    线性表算法设计题2.15
    ASP.NET2.0中的GRIDVIEW控件在使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
    VS2005发布网站问题及"aspnet_merge.exe”已退出,代码为 1的错误
    弹出对话框的同时保持页面的显示(不变形)
    NET Framework 类库
    一些实用的正则表达式
    CuteEditor6.0使用配置心得体会
  • 原文地址:https://www.cnblogs.com/QuLory/p/2928939.html
Copyright © 2011-2022 走看看