Why am I getting "QQmlApplicationEngine failed to load component" during ArcGIS initialization whenever I have a mistake in my QML?

9797
3
03-07-2016 07:09 PM
JonathonGrivas
New Contributor III

Lucas Danzinger

Hello again, I'm in the process of learning QT and building a simple ArcGIS driven app. The entire time I've been working on it, I periodically attempt to run my app and it gives me back something like the below in application output:

ArcGIS.Runtime.Core: void __cdecl QmlUtils::registerTypes(const char *) ArcGIS.Runtime

ArcGIS.Runtime.Plugin: void __cdecl ArcGISRuntimePlugin::initializeEngine(class QQmlEngine *,const char *) ArcGIS.Runtime

ArcGIS.Runtime.Core: void __cdecl QmlUtils::initializeRuntimeLicense(void) Invalid clientId QVariant(QString, "39DN") status 1

ArcGIS.Runtime.Core: void __cdecl QmlUtils::initializeImageProvider(class QQmlEngine *)

ArcGIS.Runtime.Core: void __cdecl QmlUtils::initializeImageProvider(class QQmlEngine *) Setting global image provider QVariant(void*, 0x29ce2d516f0)

ArcGIS.Extras.Plugin: void __cdecl ArcGISExtrasPlugin::registerTypes(const char *) ArcGIS.Extras

ArcGIS.Extras.Plugin: void __cdecl ArcGISExtrasPlugin::registerTypes(const char *) Registering Singleton Types

ArcGIS.Extras.Core: void __cdecl TkTypes::registerTypes(const char *) ArcGIS.Extras

ArcGIS.Extras.Plugin: void __cdecl ArcGISExtrasPlugin::initializeEngine(class QQmlEngine *,const char *) ArcGIS.Extras

QQmlApplicationEngine failed to load component

C:\projects\Qt\build-Test-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\Test.exe exited with code -1

It never gives an actual error of any useful variety, it always just says "exited with code 1", and usually that line is preceded by "QqmlApplicationEngine failed to load component". This always seems to happen in the middle of the ArcGIS initializers.

Until today, I just assumed that QT creator was terrible at detecting errors in my code, because the solution was always some mistake I'd made in regards to general QT Quick types. However, I am wondering now if it might be possible that it normally gives a real error message, and somehow ArcGIS SDK is hiding that from me?

This does not happen with any one specific error, it happens at least whenever I make a mistake with QML Types, like putting a Rectangle inside of a ListModel's ListElement.   Because it happens and gives the exact same error for almost every mistake I ever make, I have spent countless hours manually tracking down my mistakes over the course of this project.

It's possible I'm using the wrong kit for my system or something, but unless I make a mistake like the one mentioned above, the application compiles and runs flawlessly on my desktop as well as my phone, so I don't really know, maybe you can help me figure it out.

The ArcGIS portion of my app runs fine when I finally figure out what QML mistake I made and fix it.

I'm running QTQuick 2.4 and ArcGIS Runtime SDK 10.2.6

I'm building for Desktop Qt 5.5.1 MSVC2013 64bit, I'm on Windows 10, 64bit.

Tags (2)
0 Kudos
3 Replies
ThomasDunn
Occasional Contributor

Jonathan,

Qt Framework QML types act the same way. Here is an example that results in the same error:

import QtQuick 2.3

import QtQuick.Window 2.2

Window {

    visible: true

    MouseArea {

        anchors.fill: parent

        onClicked: {

            Qt.quit();

        }

    }

    Text {

        text: qsTr("Hello World")

        anchors.centerIn: parent

        color: "GEORGE"

    }

}

0 Kudos
JonathonGrivas
New Contributor III

Interesting... when I run your code in a standard QT Quick application, I get the following:

Starting C:\projects\Qt\build-untitled-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\untitled.exe...

QML debugging is enabled. Only use this in a safe environment.

QQmlApplicationEngine failed to load component

qrc:/main.qml:17 Invalid property assignment: color expected

However, when I run it exactly the same way, but in an ArcGIS QT Quick application I get:

Starting C:\projects\Qt\build-untitled_arcgis-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\untitled_arcgis.exe...

QML debugging is enabled. Only use this in a safe environment.

Initializing application

ArcGIS.Runtime.Plugin: void __cdecl ArcGISRuntimePlugin::registerTypes(const char *) ArcGIS.Runtime

C:\projects\Qt\build-untitled_arcgis-Desktop_Qt_5_5_1_MSVC2013_64bit-Debug\debug\untitled_arcgis.exe exited with code -1

[Edit:  Here are the two main.qmls: ]

0 Kudos
ThomasDunn
Occasional Contributor

I see what you mean. In my tests on Mac OS X, I see the QML load error "Invalid property assignment: color expected" before the program terminates. I'm not sure why you are not seeing that on Windows. That message is generated by Qt's QQmlApplication::load method using qWarning.

I looked at this in the debugger. (You have the template source and if you like you can do this, too.) The program terminates when the C++ code ignores the failed QML load and tries to access the root component in the QML, which is not there because of the QML load error.

We will look into this more closely to see what can be done to address it in a future release. 

0 Kudos