PDA

View Full Version : Qt Android Application in Visual Studio



mentalmushroom
9th June 2016, 12:50
I'd like to know if it's possible to develop Qt android applications with Visual Studio. If so, could somebody give me advice on how to do that? I use Visual Studio 2015 (Community) and Qt 5.6 (Windows + Android versions) running on Windows 8.1 x64.

I succeeded in building Qt sensors sample with Qt Creator, but when I try to create a Visual Studio project

C:\Qt\5.6.0-android\5.6\android_armv7\bin\qmake.exe -spec win32-msvc2015 -tp vc
it generates a desktop-like application targeting x86 architecture (ARM is not available) which in addition fails to compile not finding "GLES2/gl2.h".

d_stranz
11th June 2016, 16:56
You are including the wrong mkspec file. Even though you are building through Visual Studio, it is using the android g++ toolchain. So you have to tell qmake to use the android-g++ mkspec.


Magicians do not exist

That's just an illusion.

mentalmushroom
11th June 2016, 17:49
Ok, I tried this
C:\Qt\5.6.0-android\5.6\android_armv7\bin\qmake.exe -spec android-g++ -tp vc
and this
C:\Qt\5.6.0-android\5.6\android_armv7\bin\qmake.exe -spec android-g++ -t vcapp
The answer is
WARNING: Unable to generate output for: Z:/test/Makefile [TEMPLATE vcapp]
Not sure what Makefile it tried to generate output for as there is no Makefile. I have only a .pro file and want to generate visual studio project for android development.

d_stranz
12th June 2016, 20:13
What happens if you import the .pro file into Visual Studio using the Qt VS Plugin? If you build it from within VS, at some point you will have to tell VS which toolchain to use (via the "Configuration Manager"). You are sort of trying to mix apples and oranges here - either let qmake do the work of managing your project or let Visual Studio do it. So if you use the VS plugin wizard to start your project from scratch from within VS, then you'll likely have fewer mismatch issues.

mentalmushroom
13th June 2016, 07:02
If you mean Qt Visual Studio Add-in, as far as I know it doesn't work with VS2015, which I use:
http://blog.qt.io/blog/2016/03/16/qt-5-6-released/

Thus, I can't try that...

d_stranz
13th June 2016, 17:00
I don't know about that. It's working for me.

The Add-in installs itself to VS 2015, as the "Help -> About" in VS 2015 shows.



Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

Visual Basic 2015 00322-50050-...
Microsoft Visual Basic 2015

Visual C# 2015 00322-50050-...
Microsoft Visual C# 2015

Visual C++ 2015 00322-50050-...
Microsoft Visual C++ 2015

AnkhSVN - Subversion Support for Visual Studio 2.6.12735.14
AnkhSVN - Subversion Support for Visual Studio 2.6.12735.14
* Ankh.Package 2.6.12735.14
* Subversion 1.9.2 via SharpSvn 1.9002.3777.76

SharpSvn is linked to: Apr 1.5.1, Apr-util 1.5.4, Cyrus Sasl 2.1.26, eXpat 2.1.0, LibSSH2 1.6.0, OpenSSL 1.0.2d 9 Jul 2015, Serf 1.3.8, SQLite 3.8.11.1, Subversion 1.9.2-SharpSvn, Utf8proc 1.1.5, ZLib 1.2.8
SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 0.65.0(SharpSvn)

Atomineer Pro Documentation 1.0
Source-code documentation-comment creation and maintenance, and other documentation-related tools.

Common Azure Tools 1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest 1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio 1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Intel® Parallel Studio XE 2016 Update 2 Composer Edition for C++ Windows* Package ID: w_comp_lib_2016.2.180
Intel® Parallel Studio XE 2016 Update 2 Composer Edition for C++ Windows* Integration for Microsoft* Visual Studio* 2015, Version 16.0.107.14, Copyright © 2002-2016 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

NuGet Package Manager 3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

NVIDIA Nsight Visual Studio Edition 5.1.0.16062
NVIDIA Nsight Visual Studio Edition provides tools for GPGPU and graphics development. Copyright © NVIDIA 2010 - 2016.
•Direct3D® and DirectX® are registered trademarks of Microsoft Corporation in the United States and/or other countries.
•Microsoft Detours is used under the Professional license (http://research.microsoft.com/en-us/projects/detours/).
•Gardens Point Parser Generator Copyright 2005 Queensland University of Technology (QUT). All rights reserved.
•NLog Copyright © 2004-2006 Jaroslaw Kowalski (jaak@jkowalski.net)
•IronPython and WPFToolkit used under Microsoft Public License (Ms-PL) and are Copyright © Microsoft Corporation
•Portions of RadControls for WPF © 2010-2011 by Telerik Corporation. All rights reserved.
•zlib and libpng used under the zlib/libpnc license (http://opensource.org/licenses/Zlib)

Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio 2.2.30718.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration 2.2.30718.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support 2.2.30718.00
Profiling support for Python projects.

Qt5Package 1.3.9
Fully functional repeats Qt VS Addin

Visual Assist
For more information about Visual Assist, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c) 1997-2016 Whole Tomato Software, Inc.

Visual C++ for Cross Platform Mobile Development 1.0
Visual C++ for Cross Platform Mobile Development

Visual C++ for Cross Platform Mobile Development 1.0
Visual C++ for Cross Platform Mobile Development


And as the screenshot shows, it works when adding a new project to a solution:

11977

mentalmushroom
14th June 2016, 07:42
Ok, Qt5Package seems to be a third-party replacement for Qt Add-in. I've just installed it. Unfortunately it doesn't work well. Probably, because I have several Qt versions installed and the primary qmake points to Qt4 location.

The first issue I faced when trying to open the .pro file. It complained about not finding qmake and asked whether I had set the qt version. So I tried to add the version for android:


Version name: 5.6-android-armv7
Path: C:\Qt\5.6.0-android\5.6\android_armv7

It failed with the following error:

This Qt version uses an unsupported makefile generator (used: , supported: MSVC.NET, MSBUILD)

Then I tried to add a Qt5 version for desktop:


Qt Version: 5.6-desktop
Path: C:\Qt\5.6.0\5.6\msvc2015

It seemed to work fine, but when I try to build a newly created GUI application it fails with the following:


1>------ Build started: Project: testqtgui, Configuration: Debug Win32 ------
1> Moc'ing testqtgui.h...
1> The system cannot find the path specified.
1> Uic'ing testqtgui.ui...
1> The system cannot find the path specified.
1> Rcc'ing testqtgui.qrc...
1> The system cannot find the path specified.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cp pCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 3.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

A console application fails to compile in a different way. It can't find QtCore.

Building qmake-generated project in VS still works fine, but not for android.

d_stranz
14th June 2016, 15:36
This Qt version uses an unsupported makefile generator (used: , supported: MSVC.NET, MSBUILD)

Google is your friend on this one. Search the entire quoted string, first hit gives the answer.

mentalmushroom
15th June 2016, 07:31
Nope... Google didn't prove to be a good friend in this case. The first answer is about Qt5.6-windows-beta and the error is slightly different: they seemed to have their MAKEFILE_GENERATOR set to a wrong value, while mine isn't set at all. I have tried all the suggestions, but none of them worked.

I've found somebody else reporting the same problem for this very extension about Qt-WinRT version, but nobody replied to him:
https://visualstudiogallery.msdn.microsoft.com/c89ff880-8509-47a4-a262-e4fa07168408

d_stranz
15th June 2016, 17:24
Well, sorry. You -can- configure Qt Creator to use the android compilers if you want to go that route instead of using Visual Studio, but I prefer VS myself.