简体   繁体   English

在Android应用程序上部署Qt时出错

[英]Error deploying Qt on Android application

I am trying to run my first Qt Android application and I followed this tutorial: 我正在尝试运行我的第一个Qt Android应用程序,我遵循了本教程:

http://urfoex.blogspot.ro/2013/12/qt5-android-setting-up-qt-52-for-android.html http://urfoex.blogspot.ro/2013/12/qt5-android-setting-up-qt-52-for-android.html

However, after I ran it i got this error: 但是,在我运行它后,我收到此错误:

i686-linux-android-g++: error: unrecognized command line option '-marm' make: *** 
[main.o] Error 1 21:33:42: The process "make" exited with code 2.
Error while building/deploying project avd_tests (kit: Android for x86 (GCC 4.8, Qt 5.2.1)) When executing step 'Make'

I also tried using armeabi but i got: 我也尝试过使用armeabi但我得到了:

In file included from ../.android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/algorithm:60:0,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtCore/qglobal.h:82,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtCore/qcoreapplication.h:45,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtWidgets/qapplication.h:45,
                 from ../.Qt5.2.1/5.2.1/android_armv7/include/QtWidgets/QApplication:1,
                 from ../avd_tests/qtquick2controlsapplicationviewer/qtquick2controlsapplicationviewer.h:13,
                 from ../avd_tests/main.cpp:1: ../.android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/utility:68:28: fatal error: bits/c++config.h: No such file or directory  #include <bits/c++config.h>
                            ^ compilation terminated. make: *** [main.o] Error 1 21:44:14: The process "make" exited with code 2. Error while building/deploying project avd_tests (kit: Android for armeabi-v7a (GCC 4.8, Qt 5.2.1)) When executing step 'Make'

The application I am building is a default Qt Quick application. 我正在构建的应用程序是默认的Qt Quick应用程序。 I am using Qt 5.2.1 and QtCreator 3.0.1 . 我正在使用Qt 5.2.1QtCreator 3.0.1

Anyone any Idea what it could be or does anyone know a good guide on how to make Qt on Android work on GNU/Linux ? 任何人都知道它可能是什么或有没有人知道如何让Android上的QtGNU/Linux上工作?

You should download and install Qt 5.2.1 for Android (Linux 32-bit or 64-bit) from here . 您应该从这里下载并安装Qt 5.2.1 for Android(Linux 32位或64位)。 Qt Project's SDK is not coming with Android SDK/NDK so you must download and install them yourself from here . QT项目的SDK不与Android SDK / NDK来,所以你必须下载并自行安装,从他们这里 You'll need Android NDK (ver. r9+) and SDK (ver. 22+). 你需要Android NDK(版本r9 +)和SDK(版本22+)。

If you don't plan to create Android Java apps, then make sure you are downloading ONLY the SDK and not ADT Bundle or Android Studio. 如果您不打算创建Android Java应用程序,请确保仅下载SDK而不是ADT Bundle或Android Studio。

After downloading extract them. 下载后提取它们。 For Android SDK you should have a connection to Internet and download the desired tools. 对于Android SDK,您应该连接到Internet并下载所需的工具。 you have to install at least Android API-13! 你必须安装至少Android API-13! You also must install Android SDK Platform-tools and Android SDK Build-tools. 您还必须安装Android SDK Platform-tools和Android SDK Build-tools。

Open Qt Creator. 打开Qt Creator。 Goto Tools->Option->Android settings page and set Android SDK and NDK locations. 转到Tools->Option->Android设置页面并设置Android SDK和NDK位置。

You can find a detailed tutorial Here . 你可以在这里找到详细的教程。

It turns out it was a known bug in the newer version of Android SDK . 事实证明,这是新版Android SDK中的一个已知错误。

As pointed by Bogdan Vatra , the creator of Qt for Android , the solutions were: 正如Qt for Android的创建者Bogdan Vatra指出的那样,解决方案是:

  • Find an older Android SDK. 查找较旧的Android SDK。
  • Upgrade your Qt creator (use Qt SDK 5.3) 升级你的Qt创建者(使用Qt SDK 5.3)
  • Use a real device. 使用真实设备。

In order to solve the problem I downloaded qt-opensource-linux-x64-android-5.3.0-RC_2014-04-14_00-48-35-55.run from http://download.qt-project.org/snapshots/qt/5.3/5.3.0-RC/2014-04-14_55/ and the deploy worked successfully! 为了解决这个问题,我从http://download.qt-project.org/snapshots/下载了qt-opensource-linux-x64-android-5.3.0-RC_2014-04-14_00-48-35-55.run qt / 5.3 / 5.3.0-RC / 2014-04-14_55 /并且部署成功!

Thanks Bogdan! 谢谢波格丹!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM