https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
aria2c "http://download.qt.io/archive/qt/5.8/5.8.0/qt-opensource-linux-x64-android-5.8.0.run"
/usr/lib/jvm/java-1.8.0-openjdk-amd64
PyQt5-5.8.2-5.8.0-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl
pyqtdeploy-1.3.2-py3-none-any.whl
sudo pip3 install PyQt5
sudo apt install openjdk-8-jdk
sudo apt install openjdk-8-jdk-headless
sudo apt install ant
sudo pip3 install pyqtdeploy
export PATH=/home/harry159821/.local/bin:$PATH
export ANDROID_NDK_ROOT=~/android/android-ndk
export ANDROID_NDK_ROOT=~/android/android-sdk
export SYSROOT=~/SYSROOT
export PYTHONPATH=/usr/lib/python3.5/site-packages
export PATH=$PATH:~/android/android-sdk/platform-tools:~/android/android-sdk/tools
alias sethp="export http_proxy='http://127.0.0.1:1090' && export https_proxy='http://127.0.0.1:1090'"
alias sethpno="unset http_proxy && unset https_proxy"
0.Patch PyQtDeploy
Edit _write_scope_guard Line 1215:/usr/local/lib/python3.5/dist-packages/pyqtdeploy/builder/builder.py
f.write('#if {0}defined({1})\n'.format('', cls._guards[scope]))
Edit _add_value_for_scopes Line 968:/usr/local/lib/python3.5/dist-packages/pyqtdeploy/builder/builder.py
# This usually makes the generated code shorter because non-Windows
# scopes will be collapsed into one.
# scopes = ['!' + (set(ALL_SCOPES) - set(scopes)).pop()]
scopes = [(set(ALL_SCOPES) - set(scopes)).pop()]
1.Patch Python
delete android-ndk/platforms/android-16
cp android-ndk/platforms/android-23 android-ndk/platforms/android-16
OR
export ANDROID_NDK_PLATFORM=23
export ANDROID_NDK_TOOLCHAIN_VERSION=23
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Include/unicodeobject.h
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Lib/_bootlocale.py
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Lib/locale.py
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/_decimal/_decimal.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/_localemodule.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/getpath.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/grpmodule.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/main.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/posixmodule.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/pwdmodule.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/termios.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/zlib/gzlib.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/zlib/minigzip.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Objects/unicodeobject.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Python/fileutils.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Python/formatter_unicode.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Python/pylifecycle.c
Patching /home/harry159821/SYSROOT/src/Python-3.5.2/Python/pystrtod.c
cd python src folder
pyqtdeploycli --package python --target android-32 configure
Edit
/home/harry159821/SYSROOT/src/Python-3.5.2/Modules/config.c
/home/harry159821/SYSROOT/src/Python-3.5.2/python.pro
qmake SYSROOT=/home/harry159821/SYSROOT
make
make install
2.Sip
pyqtdeploycli --package sip --target android-32 configure
python3 configure.py --static --sysroot=/home/harry159821/SYSROOT/ --no-tools --use-qmake --configuration=sip-android.cfg
qmake
export C_INCLUDE_PATH=/usr/include/python3.5
export C_INCLUDE_PATH=/home/harry159821/SYSROOT/src/Python-3.5.2/Include/
Edit /usr/include/python3.5/pyconfig.h
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
// # include <arm-linux-gnueabi/python3.5m/pyconfig.h>
# include </home/harry159821/SYSROOT/src/Python-3.5.2/pyconfig.h>
Then Install Another Sip In System
python3 ./configure.py
make
sudo make install
3.PyQt5
pyqtdeploycli --package pyqt5 --target android-32 configure
python3 configure.py --static --verbose --sysroot=/home/harry159821/SYSROOT --no-tools --no-qsci-api --no-designer-plugin --no-qml-plugin --configuration=pyqt5-android.cfg --qmake=/home/harry159821/Qt5.8.0/5.8/android_armv7/bin/qmake
make
sudo make install
4.deploy
subl helloworld.py
pyqtdeploy helloworld.pdy
cd build
qmake
make install INSTALL_ROOT=deploy
/home/harry159821/Qt5.8.0/5.8/android_armv7/bin/androiddeployqt \
--input android-lib*.so-deployment-settings.json \
--output deploy
adb install -r deploy/bin/QtApp-debug.apk
5.Patch Patch Patch
1.if_nameindex ndk
https://bugs.python.org/issue28538
https://bugs.python.org/file45394/if_nameindex.patch
/home/harry159821/SYSROOT/src/Python-3.5.2/Modules/socketmodule.c
struct if_nameindex
{
unsigned int if_index; /* 1, 2, ... */
char *if_name; /* null terminated name: "eth0", ... */
};
Failed
NONONONONO
Edit File /home/harry159821/SYSROOT/src/Python-3.5.2/Modules/socketmodule.h
#undef HAVE_IF_NAMEINDEX
2.xmlprase.c
/home/harry159821/SYSROOT/src/Python-3.5.2/Modules/expat/xmlparse.c
/* Handle the case where memmove() doesn't exist. */
#ifndef HAVE_MEMMOVE
#ifdef HAVE_BCOPY
#define memmove(d,s,l) bcopy((s),(d),(l))
#else
// #error memmove does not exist on this platform, nor is a substitute available
void *
memmove (void *dest0, void const *source0, size_t length)
{
char *dest = dest0;
char const *source = source0;
if (source < dest)
/* Moving from low mem to hi mem; start at end. */
for (source += length, dest += length; length; --length)
*--dest = *--source;
else if (source != dest)
{
/* Moving from hi mem to low mem; start at beginning. */
for (; length; --length)
*dest++ = *source++;
}
return dest0;
}
3.
Edit python.pro
Modules/_posixsubprocess.c \
Modules/selectmodule.c \
Modules/termios.c \
Modules/grpmodule.c \
Modules/_struct.c \
Edit Modules/config.c
extern PyObject* PyInit__symtable(void);
extern PyObject* PyInit__posixsubprocess(void);
extern PyObject* PyInit_select(void);
extern PyObject* PyInit_termios(void);
extern PyObject* PyInit_grp(void);
extern PyObject* PyInit__struct(void);
{"_symtable", PyInit__symtable},
{"_posixsubprocess", PyInit__posixsubprocess},
{"select", PyInit_select},
1.QML Project
ERROR:QOpenGLShaderProgram: could not create shader program
pip3 install --upgrade PyOpenGL
sudo apt install python3-opengl
2.PyQt5 With QML???? TODO
pyqtdeploycli --package pyqt5 --target android-32 configure
python3 configure.py --static --verbose --sysroot=/home/harry159821/SYSROOT --no-tools --no-qsci-api --no-designer-plugin --configuration=pyqt5-android.cfg --qmake=/home/harry159821/Qt5.8.0/5.8/android_armv7/bin/qmake
make
sudo make install
3.Python Ctypes In android
ffi.h No such file or directory
Copy Header And C Files
Edit /home/harry159821/SYSROOT/src/Python-3.5.2/Include/fficonfig.h
COMMINT
// #define abort() exit(999)
Edit /home/harry159821/SYSROOT/src/Python-3.5.2/Include/ffi_common.h
/* Do not move this. Some versions of AIX are very picky about where
this is positioned. */
// #ifdef __GNUC__
// # define alloca __builtin_alloca
// #else
// # if HAVE_ALLOCA_H
// # include <alloca.h>
// # else
// # ifdef _AIX
// #pragma alloca
// # else
// # ifndef alloca /* predefined by HP cc +Olibcalls */
// char *alloca ();
// # endif
// # endif
// # endif
// #endif
ELSE:
cd .. && cd build && qmake && make install INSTALL_ROOT=deploy
/home/harry159821/Qt5.8.0/5.8/android_armv7/bin/androiddeployqt \
--input android-lib*.so-deployment-settings.json \
--output deploy && adb install -r deploy/bin/QtApp-debug.apk
DEBUG
04-08 17:20:11.416: W/libhelloworldQML.so(11877): (null):0 ((null)):
file:///data/data/org.qtproject.example.helloworldQML/files/:/main.qml:-1 No such file or directory
Edit System/build.prop And Reboot!!
把ro.secure设为0,persist.service.adb.enable设为1,adbd进程就会以root用户的身份启动。
log.redirect-stdio=true
没有合适的资源?快使用搜索试试~ 我知道了~
PyQtDeploy Android 项目以及编译 APK 文件
共4个文件
txt:2个
7z:2个
需积分: 50 66 下载量 13 浏览量
2018-10-12
14:06:44
上传
评论 5
收藏 36.49MB ZIP 举报
温馨提示
Pyqtdeploy Android PyQtForAndroid 使用 PyQtDeploy 将 Python PyQt Sip 等编译到 Android 平台 内含一个 PyQt 写 在 Ubuntu 编译的 B站弹幕下载器 和一个 Windows 下编译的 HelloWorld 以及两份笔记 详细看 http://blog.csdn.net/harry159821/article/details/48295777
资源推荐
资源详情
资源评论
收起资源包目录
PyQtDeployForAndroid-bilidancomment.zip (4个子文件)
helloworld.7z 16.81MB
StaticBuildPyQtAndroidNoteFotWindows.txt 2KB
bilidancomment.7z 19.68MB
StaticBuildPyQtAndroidNoteForLinux.txt 10KB
共 4 条
- 1
资源评论
harry159821
- 粉丝: 15
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功