简体   繁体   English

Android上的PyQt5

[英]PyQt5 on android

I was wondering if someone could explain to me how you make your PyQt5 application run on Android. 我想知道是否有人可以向我解释您如何使PyQt5应用程序在Android上运行。 The documentation is not very explicit regarding Android to say the least. 至少可以说,关于Android的文档不是很明确。

I am building on a Kubuntu desktop. 我在Kubuntu桌面上构建。 I have Android NDK and SDK installed, I have Qt 5.5.1 for android. 我已经安装了Android NDK和SDK,我已经为Android安装了Qt 5.5.1。

I don't know how to proceed from here. 我不知道如何从这里继续。 I tried building PyQt5 for android like I would build it for Linux: 我尝试为Android构建PyQt5,就像为Linux构建一样:

ANDROID_NDK_ROOT=<MY_NDK_INSTALLATION> python configure.py -q <PATH_TO_ANDROID_QMAKE>

but that just returns the following error: 但这只会返回以下错误:

Querying qmake about your Qt installation...
Determining the details of your Qt installation...
/home/jakob/Qt/5.5/android_armv7/bin/qmake -o qtdetail.mk qtdetail.pro
make -f qtdetail.mk
/home/jakob/dev/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I../../../Qt/5.5/android_armv7/include -I../../../Qt/5.5/android_armv7/include/QtCore -I. -I../../android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/include -I../../android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I../../android/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -I../../../Qt/5.5/android_armv7/mkspecs/android-g++ -o qtdetail.o qtdetail.cpp
/home/jakob/dev/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/jakob/dev/android/android-ndk-r10e/platforms/android-9/arch-arm/ -Wl,-soname,libqtdetail.so -Wl,-rpath=/home/jakob/Qt/5.5/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libqtdetail.so qtdetail.o   -L/home/jakob/dev/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -L/home/jakob/dev/android/android-ndk-r10e/platforms/android-9/arch-arm//usr/lib -L/home/jakob/Qt/5.5/android_armv7/lib -lQt5Core -L/opt/android/ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -L/opt/android/ndk/platforms/android-9/arch-arm//usr/lib -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
Error: Failed to determine the detail of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.

Can anybody give a hint? 有人可以提示吗?

It would really be nice if someone could provide a guide to using PyQt5 on Android. 如果有人可以提供在Android上使用PyQt5的指南,那将是非常不错的。

The code of qtdetail just generates a plain-text config so I ran its source on my Android-device and got this: qtdetail的代码只是生成一个纯文本配置,所以我在Android设备上运行了它的源代码并得到了这个:

Open Source
shared
PyQt_Desktop_OpenGL

If you can not repeat my steps, you can apply this patch to configure.py (for Unix-like platforms) 如果您无法重复我的步骤,则可以将此补丁应用到configure.py(对于类似Unix的平台)

697,698c697,699
<         cmd = compile_qt_program(self, verbose, 'qtdetail', source, 'QtCore',
<                 debug=debug)
---
>         # cmd = compile_qt_program(self, verbose, 'qtdetail', source, 'QtCore',
>         #         debug=debug)
>         cmd = """echo "Open Source\nshared\nPyQt_Desktop_OpenGL" > qtdetail.out"""

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

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