简体   繁体   English

Android 上的 Qt - C++ 代码是否在 Dalvik 虚拟机中运行

[英]Qt on Android - does the C++ code run in the Dalvik virtual machine

I have heard it said that the C++ code runs "natively" on all platforms.我听说它说 C++ 代码在所有平台上“本机”运行。 By this I guess that what is being suggested is that the cross-platform ability of Qt is not using something like HTML 5.据此,我猜所建议的是 Qt 的跨平台能力不使用 HTML 5 之类的东西。

But does this mean that on Android Qt code runs in the Dalvik virtual machine?但这是否意味着在 Android 上 Qt 代码在 Dalvik 虚拟机中运行?

Please check https://www.qt.io/blog/2013/07/23/anatomy-of-a-qt-5-for-android-application请检查https://www.qt.io/blog/2013/07/23/anatomy-of-a-qt-5-for-android-application

At the very top of levels, a Qt for Android application consists of two parts:在最顶层,适用于 Android 的 Qt 应用程序由两部分组成:

The Qt application: This is the cross-platform code and resources that you, as the app developer, manage yourself, and which are summarized by your qmake .pro file. Qt 应用程序:这是您作为应用程序开发人员自行管理的跨平台代码和资源,并由您的 qmake .pro 文件汇总。

An Android application launcher: This is generated for you by Qt Creator the first time you connect your project to a Qt for Android Kit. Android 应用程序启动器:这是在您第一次将项目连接到 Qt for Android Kit 时由 Qt Creator 为您生成的。

So, Android application launcher should run in Dalvik VM.因此,Android 应用程序启动器应该在 Dalvik VM 中运行。 I can't sure if this works well with ART runtime of Android 5.0我不确定这是否适用于 Android 5.0 的ART 运行时

Android understands either Dalvik or the newer ART. Android 理解 Dalvik 或更新的 ART。 Dalvik and ART both have the ability to link to C/C++ code through the Android NDK which is Android's take on JNI. Dalvik 和 ART 都能够通过 Android NDK 链接到 C/C++ 代码,Android NDK 是 Android 对 JNI 的采用。 QT for Android while being C++ based still requires a minimal amount of Java based initialization.适用于 Android 的 QT 虽然基于 C++,但仍需要最少量的基于Java的初始化。 What this means is that even if the C++ code runs natively (architecture dependent) to the underlying OS, it is still required to be presented through code that runs on the VM (Android specific) as the VM does not directly understand C++ but can link to it through it's own Java based framework which is the Android NDK.这意味着即使 C++ 代码本地运行(依赖于架构)到底层操作系统,它仍然需要通过运行在 VM 上的代码(Android 特定)来呈现,因为 VM 不直接理解 C++ 但可以链接它通过它自己的基于 Java 的框架 Android NDK 来实现。

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

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