buildozer 自动部署python-for-android 之从自信满满到放弃

耿志义
2023-12-01

#####################################################

记录失败过程各种问题解决方法

#####################################################

‘’‘最后吐血放弃’‘’

主要修改python-for-android 目录下 下载环境链接,各文件夹__init__.py文件内链接到本地

项目目录/.buildozer/android/platform/python-for-android/pythonforandroid/recipes

环境要求python3

必须pip安装buildozer  源码 包安装会出现重重问题
pip install buildozer

安装模块:
pip install sh pexpect virtualenv  pexpect   --trusted-host mirrors.aliyun.com
加--trusted-host mirrors.aliyun.com 省去了很多pip问题

运行buildoer  提示python-for-android
git https://github.com/kivy/python-for-android.git/  之类错误

which buildoer  查找buildoer程序目录
vim buildoer 根据load_entry_point() 接入点内容进python程序目录修改
targets目录下android.py
class TargetAndroid(Target):
    p4a_fork = 'mirrors'


查找https://github 全部改成https://gitee

方法二 直接下载android-for-android 解压放到项目目录/。buildoze/android/platform目录下即可

其他
问题no pip  
解决:上https://pypi.org/project/pip/#files下载源码解压安装
python setup.py install

问题ERROR: Package 'more-itertools' requires a different Python: 2.7.15 not in '>=3.4'
解决:pip install more-itertools==5.0.0

问题
解决:
提示的下载地址直接复制迅雷下载可以了,https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip

/root/testapp/.buildozer/android/platform/python-for-android/pythonforandroid/recipes

问题
exec autoreconf not found
解决:
安装autoconf
yum install autoconf libtool automake

问题
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
解决:
安装automake  卸载yum安装的libtool autoconfig


python3.9
pip安装Cython错误
下载源码安装
https://gitee.com/mirrors/cython.git

python2换python3
yum包管理是使用python2.x写的,将python2.x升级到python3.x以后,由于python版本语法兼容性导致问题
解决办法:
修改yum将python版本指向以前的旧版本
# vi /usr/bin/yum
#!/usr/bin/python2.7

git 版本1.7.10以上不然报错
修改python包里buildozer 里android.py
修改github地址
git 参数去掉--

添加hosts  dl.google.com 到香港google

安装jdk 1.8  低版本报错
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli : Unsupported major.minor version 52.0

问题:
  STDOUT:
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:3: error: Autoconf version 2.68 or higher is required
configure.ac:3: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
原因是阿里云的镜像源版本低
解决:
rpm -qf /usr/bin/autoconf
autoconf-2.63-5.1.el6.noarch
卸载yum remove autoconf   包括依赖包
wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
wget ftp://ftp.gnu.org/gnu/automake/automake-1.9.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/
make && make install

问题:
configure.ac:41: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
解决:
wget ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz
下载安装

问题:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/sh ./config.sub arm-linux-androideabi failed
解决:
https://blog.csdn.net/kobesdu/article/details/83048574 
网上都说config.sub版本不同 换上还是不管用,检查发现文件不是从libtool拷贝的,查找哪里来的替换掉

问题:
patch 。。。。

解决:
把补丁文件换成空的,remove-version-info.patch


《《《《《《《《《《《《《《《《《《《《《
最后吐血放弃
奉劝大家下载封装好的镜像使用,官方提供镜像不是没有原因的!!
》》》》》》》》》》》》》》》》》》》》》》》》》》》

 类似资料: