user123_456
user123_456

Reputation: 5805

QML loading , file not found

I am developing app for Android. And as some of members suggested to use QML for gui design I came to this problem. When I load app on desktop everything goes nicely. But problem is when porting it on Andorid. Here is my error:

`W/Qt      ( 1819): file:///data/data/org.kde.necessitas.example.Imenik/files/gui.qml:` 
File not found

And my code to start QML is :

QDeclarativeView view; 
     view.setSource(QUrl::fromLocalFile("gui.qml")); 
     view.show(); 

This is my pro file:

SOURCES += main.cpp mainwindow.cpp 
HEADERS += mainwindow.h 
FORMS += mainwindow.ui 
QT += \ 
      network \ 
      xml \ 
      declarative 

I really don't know where the problem might be. I have tried run it as desktop app and everything works nicley. but cannot port it on android.

Upvotes: 2

Views: 2302

Answers (1)

blakharaz
blakharaz

Reputation: 2590

Probably your QML file is not deployed on the phone.

Add something like

QML_FILES.source = qml
QML_FILES.target = .
DEPLOYMENTFOLDERS += QML_FILES

# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()

to your .pro file. Make sure the last two lines are at the end. This works for Symbian and Harmattan, maybe deployment is a little different with Necessitas.

Upvotes: 3

Related Questions